lkml.org 
[lkml]   [2007]   [Sep]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH][-mm] Fix setup_per_zone_pages_min() lock.
From
Date
On Mon, 2007-09-03 at 19:46 +0900, KAMEZAWA Hiroyuki wrote:
> Fix setup_per_zone_pages_min().
>
> Now setup_per_zone_pages_min() uses zone->lru_lock. This has 2 problems.
>
> 1. setup_page_zone_pages_min() modifies zone->pages_min,pages_low,pages_high.
> in atomic. But readers of these values tend not to take lru_lock.
> (At least, we need lock between memory hotplug vs. sysctl)
> 2. setup_zone_migrate_reserve() should take zone->lock instead of lru_lock.
>
> This patch replaces zone->lru_lock with zone->lock.
>

Does it really matter as they routinely do not take zone->lru_lock
either? pages_min, pages_low and pages_high are currently examined on a
regular basis by zone_watermark_ok() without any locks held in the page
allocator and page reclaim path. Glancing through this, it would appear
that the code in question has the same level of locking protection with
zone->lru_lock or zone->lock.

Is memory hotadd specifically taking the lru_lock somewhere? I can only
think of the seqlock at the moment.

> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

>
>
> ---
> mm/page_alloc.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> Index: devel-2.6.23-rc4-mm1-zone/mm/page_alloc.c
> ===================================================================
> --- devel-2.6.23-rc4-mm1-zone.orig/mm/page_alloc.c
> +++ devel-2.6.23-rc4-mm1-zone/mm/page_alloc.c
> @@ -4176,8 +4176,8 @@ void setup_per_zone_pages_min(void)
>
> for_each_zone(zone) {
> u64 tmp;
> + spin_lock_irqsave(&zone->lock, flags);
>
> - spin_lock_irqsave(&zone->lru_lock, flags);
> tmp = (u64)pages_min * zone->present_pages;
> do_div(tmp, lowmem_pages);
> if (is_highmem(zone)) {
> @@ -4208,8 +4208,9 @@ void setup_per_zone_pages_min(void)
>
> zone->pages_low = zone->pages_min + (tmp >> 2);
> zone->pages_high = zone->pages_min + (tmp >> 1);
> +
> setup_zone_migrate_reserve(zone);
> - spin_unlock_irqrestore(&zone->lru_lock, flags);
> + spin_unlock_irqrestore(&zone->lock, flags);
> }
>
> /* update totalreserve_pages */
>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-09-06 15:03    [W:0.041 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site