Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mm: add comments on pglist_data zones

While making other modifications it was easy to confuse the two struct
members node_zones and node_zonelists. For those already familiar with
the code, this might seem to be a silly patch, but it's quite helpful to
disambiguate the similar-sounding fields

While here, add a small comment on why nr_zones isn't simply MAX_NR_ZONES

Signed-off-by: Ben Widawsky <ben.widawsky@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Link: http://lkml.kernel.org/r/20200520205443.2757414-1-ben.widawsky@intel.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Ben Widawsky and committed by
Linus Torvalds
496df3d3 cc989e78

+13 -1
+13 -1
include/linux/mmzone.h
··· 660 660 * per-zone basis. 661 661 */ 662 662 typedef struct pglist_data { 663 + /* 664 + * node_zones contains just the zones for THIS node. Not all of the 665 + * zones may be populated, but it is the full list. It is referenced by 666 + * this node's node_zonelists as well as other node's node_zonelists. 667 + */ 663 668 struct zone node_zones[MAX_NR_ZONES]; 669 + 670 + /* 671 + * node_zonelists contains references to all zones in all nodes. 672 + * Generally the first zones will be references to this node's 673 + * node_zones. 674 + */ 664 675 struct zonelist node_zonelists[MAX_ZONELISTS]; 665 - int nr_zones; 676 + 677 + int nr_zones; /* number of populated zones in this node */ 666 678 #ifdef CONFIG_FLAT_NODE_MEM_MAP /* means !SPARSEMEM */ 667 679 struct page *node_mem_map; 668 680 #ifdef CONFIG_PAGE_EXTENSION