History

[PATCH] Check for populated zone in __drain_pages

Both process_zones() and drain_node_pages() check for populated zones before touching pagesets. However, __drain_pages does not do so, This may result in a NULL pointer dereference for pagesets in unpopulated zones if a NUMA setup is combined with cpu hotplug. Initially the unpopulated zone has the pcp pointers pointing to the boot pagesets. Since the zone is not populated the boot pageset pointers will not be changed during page allocator and slab bootstrap. If a cpu is later brought down (first call to __drain_pages()) then the pcp pointers for cpus in unpopulated zones are set to NULL since __drain_pages does not first check for an unpopulated zone. If the cpu is then brought up again then we call process_zones() which will ignore the unpopulated zone. So the pageset pointers will still be NULL. If the cpu is then again brought down then __drain_pages will attempt to drain pages by following the NULL pageset pointer for unpopulated zones.

Christoph Lameter committed 19 years ago

Commit f2e12bb1 parent 6929da41 file · +3 −0Browse files

Unified · Split

mm/page_alloc.c+3−0
@@ -711,6 +711,9 @@ static void __drain_pages(unsigned int cpu) · 710 unmodified lines
711 for_each_zone(zone) {711 for_each_zone(zone) {
712 struct per_cpu_pageset *pset;712 struct per_cpu_pageset *pset;
713 713
714 if (!populated_zone(zone))
715 continue;
716
714 pset = zone_pcp(zone, cpu);717 pset = zone_pcp(zone, cpu);
715 for (i = 0; i < ARRAY_SIZE(pset->pcp); i++) {718 for (i = 0; i < ARRAY_SIZE(pset->pcp); i++) {
716 struct per_cpu_pages *pcp;719 struct per_cpu_pages *pcp;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t