Skip to content

Commit 02c2c24

Browse files
Yaowei Baisfrothwell
authored andcommitted
mm/zonelist: enumerate zonelists array index
Hardcoding index to zonelists array in gfp_zonelist() is not a good idea, let's enumerate it to improve readability. No functional change. Signed-off-by: Yaowei Bai <baiyaowei@cmss.chinamobile.com> Cc: Michal Hocko <mhocko@kernel.org> Cc: David Rientjes <rientjes@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 1677191 commit 02c2c24

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

include/linux/gfp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,9 +385,9 @@ static inline enum zone_type gfp_zone(gfp_t flags)
385385
static inline int gfp_zonelist(gfp_t flags)
386386
{
387387
if (IS_ENABLED(CONFIG_NUMA) && unlikely(flags & __GFP_THISNODE))
388-
return 1;
388+
return ZONELIST_NOFALLBACK;
389389

390-
return 0;
390+
return ZONELIST_FALLBACK;
391391
}
392392

393393
/*

include/linux/mmzone.h

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -571,19 +571,17 @@ static inline bool zone_is_empty(struct zone *zone)
571571
/* Maximum number of zones on a zonelist */
572572
#define MAX_ZONES_PER_ZONELIST (MAX_NUMNODES * MAX_NR_ZONES)
573573

574+
enum {
575+
ZONELIST_FALLBACK, /* zonelist with fallback */
574576
#ifdef CONFIG_NUMA
575-
576-
/*
577-
* The NUMA zonelists are doubled because we need zonelists that restrict the
578-
* allocations to a single node for __GFP_THISNODE.
579-
*
580-
* [0] : Zonelist with fallback
581-
* [1] : No fallback (__GFP_THISNODE)
582-
*/
583-
#define MAX_ZONELISTS 2
584-
#else
585-
#define MAX_ZONELISTS 1
577+
/*
578+
* The NUMA zonelists are doubled because we need zonelists that restrict
579+
* the allocations to a single node for __GFP_THISNODE.
580+
*/
581+
ZONELIST_NOFALLBACK, /* zonelist without fallback (__GFP_THISNODE) */
586582
#endif
583+
MAX_ZONELISTS
584+
};
587585

588586
/*
589587
* This struct contains information about a zone in a zonelist. It is stored

0 commit comments

Comments
 (0)