diff options
author | Christoph Lameter <cl@linux.com> | 2018-08-10 12:15:08 -0500 |
---|---|---|
committer | Christopher Lameter <cl@linux.com> | 2023-10-13 09:45:24 -0700 |
commit | 8216937c02e2cc14d3005e5cff6c15bb72672ce7 (patch) | |
tree | 6222994cae37becb7051cc76b25b5543a4c9a801 | |
parent | 047042554ce511a29790b43bfbba9e2e64de7277 (diff) | |
download | linux-largepageprotect.tar.gz |
Updates watermarks calculation for page reservationslargepageprotect
Calculate the watermarks in such a way that the reservations
are considered.
This is a problematic method since these pages can be allocated
after all if they are not broken down. Wish there would be
a better way to do this.
Signed-off-by: Christoph Lameter <cl@linux.com>
-rw-r--r-- | mm/page_alloc.c | 7 | ||||
-rw-r--r-- | mm/vmstat.c | 1 |
2 files changed, 7 insertions, 1 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 6fe9a1d7e124bc..55e724a98ab499 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5798,6 +5798,7 @@ static void __setup_per_zone_wmarks(void) unsigned long pages_min = min_free_kbytes >> (PAGE_SHIFT - 10); unsigned long lowmem_pages = 0; struct zone *zone; + int order; unsigned long flags; /* Calculate total number of !ZONE_HIGHMEM and !ZONE_MOVABLE pages */ @@ -5812,7 +5813,11 @@ static void __setup_per_zone_wmarks(void) spin_lock_irqsave(&zone->lock, flags); tmp = (u64)pages_min * zone_managed_pages(zone); do_div(tmp, lowmem_pages); - if (is_highmem(zone) || zone_idx(zone) == ZONE_MOVABLE) { + if (is_highmem(zone)) { + + for (order = 0; order < MAX_ORDER; order++) + tmp += ((u64)zone->free_area[order].min) << order; + /* * __GFP_HIGH and PF_MEMALLOC allocations usually don't * need highmem and movable zones pages, so cap pages_min diff --git a/mm/vmstat.c b/mm/vmstat.c index 9f882ee810cf0f..8f67a69d2a48eb 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1761,6 +1761,7 @@ static ssize_t protect_store(struct kobject *kobj, if (err) return err; + setup_per_zone_wmarks(); return length; } OSTATE_ATTR(protect); |