• Home
  • Raw
  • Download

Lines Matching +full:a +full:- +full:z

1 /* SPDX-License-Identifier: GPL-2.0 */
18 #include <linux/pageblock-flags.h>
19 #include <linux/page-flags-layout.h>
22 #include <linux/page-flags.h>
25 /* Free memory management - zoned buddy allocator. */
31 #define MAX_ORDER_NR_PAGES (1 << (MAX_ORDER - 1))
57 * The way to use it is to change migratetype of a range of
60 * is that a range of pageblocks must be aligned to
62 * a single pageblock.
100 #define MIGRATETYPE_MASK ((1UL << PB_migratetype_bits) - 1)
113 return list_first_entry_or_null(&area->free_list[migratetype], in get_page_from_free_area()
119 return list_empty(&area->free_list[migratetype]); in free_area_empty()
125 * zone->lock and the zone lru_lock are two of the hottest locks in the kernel.
126 * So add a wild amount of padding here to ensure that they fall into separate
128 * consumption is not a concern here.
223 NR_KERNEL_MISC_RECLAIMABLE, /* reclaimable non-slab kernel pages */
241 * Global and per-node slab counters track slab pages. in vmstat_item_in_bytes()
245 * Per-memcg and per-lruvec counters track memory, consumed in vmstat_item_in_bytes()
247 * byte-precise. in vmstat_item_in_bytes()
304 * backed by a congested BDI
311 * These track the cost of reclaiming one LRU - file or anon -
317 /* Non-resident age, driven by LRU movement */
345 #define min_wmark_pages(z) (z->_watermark[WMARK_MIN] + z->watermark_boost) argument
346 #define low_wmark_pages(z) (z->_watermark[WMARK_LOW] + z->watermark_boost) argument
347 #define high_wmark_pages(z) (z->_watermark[WMARK_HIGH] + z->watermark_boost) argument
348 #define wmark_pages(z, i) (z->_watermark[i] + z->watermark_boost) argument
355 /* Lists of pages, one per migrate type stored on the pcp-lists */
384 * DMA addressing constraints. This distinction is important as a 32bit
385 * DMA mask is assumed when ZONE_DMA32 is defined. Some 64-bit
403 * A memory area that is only addressable by the kernel through
416 * likely to succeed, and to locally limit unmovable allocations - e.g.,
419 * 1. Pinned pages: (long-term) pinning of movable pages might
421 * retry a long time.
433 * buddy (e.g., via XEN-balloon, Hyper-V balloon, virtio-mem). The
435 * some cases (virtio-mem), such pages can be skipped during
439 * of memory unplug in virtio-mem).
460 /* Read-mostly fields */
487 * Flags for a pageblock_nr_pages block. See pageblock-flags.h.
499 * spanned_pages = zone_end_pfn - zone_start_pfn;
503 * present_pages = spanned_pages - absent_pages(pages in holes);
508 * managed_pages = present_pages - reserved_pages;
512 * (present_pages - managed_pages). And managed_pages should be used
519 * It is a seqlock because it has to be read outside of zone->lock,
523 * The span_seq lock is declared along with zone->lock because it is
524 * frequently read in proximity to zone->lock. It's good to
525 * give them a chance of being in the same cacheline.
529 * present_pages should get_online_mems() to get a stable value.
541 * of pageblock. Protected by zone->lock.
553 /* Write-intensive fields used from the page allocator */
565 /* Write-intensive fields used by compaction and vmstats. */
570 * when reading the number of free pages to avoid per-cpu counter
628 return (unsigned long)atomic_long_read(&zone->managed_pages); in zone_managed_pages()
633 return zone->zone_start_pfn + zone->spanned_pages; in zone_end_pfn()
638 return zone->zone_start_pfn <= pfn && pfn < zone_end_pfn(zone); in zone_spans_pfn()
643 return zone->initialized; in zone_is_initialized()
648 return zone->spanned_pages == 0; in zone_is_empty()
652 * Return true if [start_pfn, start_pfn + nr_pages) range has a non-empty
661 start_pfn + nr_pages <= zone->zone_start_pfn) in zone_intersects()
669 * go. A value of 12 for DEF_PRIORITY implies that we will scan 1/4096th of the
674 /* Maximum number of zones on a zonelist */
682 * restrict the allocations to a single node for __GFP_THISNODE.
690 * This struct contains information about a zone in a zonelist. It is stored
695 int zone_idx; /* zone_idx(zoneref->zone) */
699 * One allocation request operates on a zonelist. A zonelist
700 * is a list of zones, the first one is the 'goal' of the
706 * a struct zoneref are
708 * zonelist_zone() - Return the struct zone * for an entry in _zonerefs
709 * zonelist_zone_idx() - Return the index of the zone for an entry
710 * zonelist_node_idx() - Return the index of the node for an entry
717 /* The array of struct pages - for discontigmem use pgdat->lmem_map */
730 * On NUMA machines, each NUMA node would have a pg_data_t to describe
731 * it's memory layout. On UMA machines there is a single pglist_data which
734 * Memory statistics and page replacement data structures are maintained on a
735 * per-zone basis.
763 * Also synchronizes pgdat->first_deferred_pfn during deferred page
770 * Nests above zone->lock and zone->span_seqlock
801 * This is a per-node reserve of pages that are not available
814 /* Write-intensive fields used by page reclaim */
843 /* Per-node vmstats */
848 #define node_present_pages(nid) (NODE_DATA(nid)->node_present_pages)
849 #define node_spanned_pages(nid) (NODE_DATA(nid)->node_spanned_pages)
851 #define pgdat_page_nr(pgdat, pagenr) ((pgdat)->node_mem_map + (pagenr))
853 #define pgdat_page_nr(pgdat, pagenr) pfn_to_page((pgdat)->node_start_pfn + (pagenr))
857 #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
862 return &pgdat->__lruvec; in node_lruvec()
867 return pgdat->node_start_pfn + pgdat->node_spanned_pages; in pgdat_end_pfn()
872 return !pgdat->node_start_pfn && !pgdat->node_spanned_pages; in pgdat_is_empty()
880 bool __zone_watermark_ok(struct zone *z, unsigned int order, unsigned long mark,
883 bool zone_watermark_ok(struct zone *z, unsigned int order,
886 bool zone_watermark_ok_safe(struct zone *z, unsigned int order,
905 return lruvec->pgdat; in lruvec_pgdat()
914 return &lruvec_pgdat(lruvec)->__lruvec == lruvec; in is_node_lruvec()
929 #define zone_idx(zone) ((zone) - (zone)->zone_pgdat->node_zones)
932 * Returns true if a zone has pages managed by the buddy allocator.
942 /* Returns true if a zone has memory */
945 return zone->present_pages; in populated_zone()
951 return zone->node; in zone_to_nid()
956 zone->node = nid; in zone_set_nid()
975 return (ZONE_MOVABLE - 1) == ZONE_HIGHMEM; in zone_movable_is_highmem()
1000 * is_highmem - helper function to quickly check if a struct zone is a
1002 * to ZONE_{DMA/NORMAL/HIGHMEM/etc} in general code to a minimum.
1003 * @zone - pointer to struct zone variable
1053 * for_each_online_pgdat - helper macro to iterate over all online nodes
1054 * @pgdat - pointer to a pg_data_t variable
1061 * for_each_zone - helper macro to iterate over all memory zones
1062 * @zone - pointer to struct zone variable
1068 for (zone = (first_online_pgdat())->node_zones; \
1073 for (zone = (first_online_pgdat())->node_zones; \
1082 return zoneref->zone; in zonelist_zone()
1087 return zoneref->zone_idx; in zonelist_zone_idx()
1092 return zone_to_nid(zoneref->zone); in zonelist_node_idx()
1095 struct zoneref *__next_zones_zonelist(struct zoneref *z,
1100 …xt_zones_zonelist - Returns the next zone at or below highest_zoneidx within the allowed nodemask …
1101 * @z - The cursor used as a starting point for the search
1102 * @highest_zoneidx - The zone index of the highest zone to return
1103 * @nodes - An optional nodemask to filter the zonelist with
1105 * This function returns the next zone at or below a given zone index that is
1106 * within the allowed nodemask using a cursor as the starting point for the
1107 * search. The zoneref returned is a cursor that represents the current zone
1111 static __always_inline struct zoneref *next_zones_zonelist(struct zoneref *z, in next_zones_zonelist() argument
1115 if (likely(!nodes && zonelist_zone_idx(z) <= highest_zoneidx)) in next_zones_zonelist()
1116 return z; in next_zones_zonelist()
1117 return __next_zones_zonelist(z, highest_zoneidx, nodes); in next_zones_zonelist()
1121 …* first_zones_zonelist - Returns the first zone at or below highest_zoneidx within the allowed nod…
1122 * @zonelist - The zonelist to search for a suitable zone
1123 * @highest_zoneidx - The zone index of the highest zone to return
1124 * @nodes - An optional nodemask to filter the zonelist with
1125 * @return - Zoneref pointer for the first suitable zone found (see below)
1127 * This function returns the first zone at or below a given zone index that is
1128 * within the allowed nodemask. The zoneref returned is a cursor that can be
1132 * When no eligible zone is found, zoneref->zone is NULL (zoneref itself is
1140 return next_zones_zonelist(zonelist->_zonerefs, in first_zones_zonelist()
1145 …ch_zone_zonelist_nodemask - helper macro to iterate over valid zones in a zonelist at or below a g…
1146 * @zone - The current zone in the iterator
1147 * @z - The current pointer within zonelist->_zonerefs being iterated
1148 * @zlist - The zonelist being iterated
1149 * @highidx - The zone index of the highest zone to return
1150 * @nodemask - Nodemask allowed by the allocator
1152 * This iterator iterates though all zones at or below a given zone index and
1153 * within a given nodemask
1155 #define for_each_zone_zonelist_nodemask(zone, z, zlist, highidx, nodemask) \ argument
1156 for (z = first_zones_zonelist(zlist, highidx, nodemask), zone = zonelist_zone(z); \
1158 z = next_zones_zonelist(++z, highidx, nodemask), \
1159 zone = zonelist_zone(z))
1161 #define for_next_zone_zonelist_nodemask(zone, z, highidx, nodemask) \ argument
1162 for (zone = z->zone; \
1164 z = next_zones_zonelist(++z, highidx, nodemask), \
1165 zone = zonelist_zone(z))
1169 …* for_each_zone_zonelist - helper macro to iterate over valid zones in a zonelist at or below a gi…
1170 * @zone - The current zone in the iterator
1171 * @z - The current pointer within zonelist->zones being iterated
1172 * @zlist - The zonelist being iterated
1173 * @highidx - The zone index of the highest zone to return
1175 * This iterator iterates though all zones at or below a given zone index.
1177 #define for_each_zone_zonelist(zone, z, zlist, highidx) \ argument
1178 for_each_zone_zonelist_nodemask(zone, z, zlist, highidx, NULL)
1191 * SECTION_SHIFT #bits space required to store a section #
1197 #define PFN_SECTION_SHIFT (SECTION_SIZE_BITS - PAGE_SHIFT)
1202 #define PAGE_SECTION_MASK (~(PAGES_PER_SECTION-1))
1205 ((1UL << (PFN_SECTION_SHIFT - pageblock_order)) * NR_PAGEBLOCK_BITS)
1207 #if (MAX_ORDER - 1 + PAGE_SHIFT) > SECTION_SIZE_BITS
1220 #define SECTION_ALIGN_UP(pfn) (((pfn) + PAGES_PER_SECTION - 1) & PAGE_SECTION_MASK)
1226 #define PFN_SUBSECTION_SHIFT (SUBSECTION_SHIFT - PAGE_SHIFT)
1228 #define PAGE_SUBSECTION_MASK (~(PAGES_PER_SUBSECTION-1))
1233 #define SUBSECTIONS_PER_SECTION (1UL << (SECTION_SIZE_BITS - SUBSECTION_SHIFT))
1253 * This is, logically, a pointer to an array of struct
1261 * Making it a UL at least makes someone do a cast
1276 * WARNING: mem_section must be a power-of-2 in size for the
1289 #define SECTION_ROOT_MASK (SECTIONS_PER_ROOT - 1)
1299 return ms->usage->pageblock_flags; in section_to_usemap()
1317 * a little bit of information. The pointer is calculated
1318 * as mem_map - section_nr_to_pfn(pnum). The result is
1320 * 1. All mem_map arrays are page-aligned.
1322 * lowest bits. PFN_SECTION_SHIFT is arch-specific
1323 * (equal SECTION_SIZE_BITS - PAGE_SHIFT), and the
1333 #define SECTION_MAP_MASK (~(SECTION_MAP_LAST_BIT-1))
1338 unsigned long map = section->section_mem_map; in __section_mem_map_addr()
1345 return (section && (section->section_mem_map & SECTION_MARKED_PRESENT)); in present_section()
1355 return (section && (section->section_mem_map & SECTION_HAS_MEM_MAP)); in valid_section()
1360 return (section && (section->section_mem_map & SECTION_IS_EARLY)); in early_section()
1370 return (section && (section->section_mem_map & SECTION_IS_ONLINE)); in online_section()
1402 return test_bit(idx, ms->usage->subsection_map); in pfn_section_valid()
1423 * the entire section-sized span. in pfn_valid()
1443 return -1; in next_present_section_nr()
1481 * If it is possible to have holes within a MAX_ORDER_NR_PAGES, then we
1484 * when we have no holes within a MAX_ORDER_NR_PAGES block.
1494 * pfn_valid() is meant to be able to tell if a given PFN has valid memmap
1495 * associated with it or not. This means that a struct page exists for this
1503 * that a valid section has a memmap for the entire section.
1508 * returns true. A walker of the full memmap must then do this additional