mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-22 06:32:08 +00:00
mm: access zone->node via zone_to_nid() and zone_set_nid()
zone->node is configured only when CONFIG_NUMA=y, so it is a good idea to have inline functions to access this field in order to avoid ifdef's in c files. Link: http://lkml.kernel.org/r/20180730101757.28058-3-osalvador@techadventures.net Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com> Signed-off-by: Oscar Salvador <osalvador@suse.de> Reviewed-by: Oscar Salvador <osalvador@suse.de> Acked-by: Michal Hocko <mhocko@suse.com> Acked-by: Vlastimil Babka <vbabka@suse.cz> Cc: Aaron Lu <aaron.lu@intel.com> Cc: Dan Williams <dan.j.williams@intel.com> Cc: David Hildenbrand <david@redhat.com> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: Mel Gorman <mgorman@techsingularity.net> Cc: Pasha Tatashin <Pavel.Tatashin@microsoft.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
ace1db3976
commit
c1093b746c
5 changed files with 28 additions and 30 deletions
|
@ -834,6 +834,25 @@ static inline bool populated_zone(struct zone *zone)
|
|||
return zone->present_pages;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NUMA
|
||||
static inline int zone_to_nid(struct zone *zone)
|
||||
{
|
||||
return zone->node;
|
||||
}
|
||||
|
||||
static inline void zone_set_nid(struct zone *zone, int nid)
|
||||
{
|
||||
zone->node = nid;
|
||||
}
|
||||
#else
|
||||
static inline int zone_to_nid(struct zone *zone)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void zone_set_nid(struct zone *zone, int nid) {}
|
||||
#endif
|
||||
|
||||
extern int movable_zone;
|
||||
|
||||
#ifdef CONFIG_HIGHMEM
|
||||
|
@ -949,12 +968,7 @@ static inline int zonelist_zone_idx(struct zoneref *zoneref)
|
|||
|
||||
static inline int zonelist_node_idx(struct zoneref *zoneref)
|
||||
{
|
||||
#ifdef CONFIG_NUMA
|
||||
/* zone_to_nid not available in this context */
|
||||
return zoneref->zone->node;
|
||||
#else
|
||||
return 0;
|
||||
#endif /* CONFIG_NUMA */
|
||||
return zone_to_nid(zoneref->zone);
|
||||
}
|
||||
|
||||
struct zoneref *__next_zones_zonelist(struct zoneref *z,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue