2008-10-01 17:41:25

by Gerald Schaefer

[permalink] [raw]
Subject: [PATCH] setup_per_zone_pages_min(): take zone->lock instead of zone->lru_lock

From: Gerald Schaefer <[email protected]>

This replaces zone->lru_lock in setup_per_zone_pages_min() with zone->lock.
There seems to be no need for the lru_lock anymore, but there is a need for
zone->lock instead, because that function may call move_freepages() via
setup_zone_migrate_reserve().

Signed-off-by: Gerald Schaefer <[email protected]>

---
mm/page_alloc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6/mm/page_alloc.c
===================================================================
--- linux-2.6.orig/mm/page_alloc.c
+++ linux-2.6/mm/page_alloc.c
@@ -4207,7 +4207,7 @@ void setup_per_zone_pages_min(void)
for_each_zone(zone) {
u64 tmp;

- spin_lock_irqsave(&zone->lru_lock, flags);
+ spin_lock_irqsave(&zone->lock, flags);
tmp = (u64)pages_min * zone->present_pages;
do_div(tmp, lowmem_pages);
if (is_highmem(zone)) {
@@ -4239,7 +4239,7 @@ 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 */


2008-10-02 05:45:26

by Kamezawa Hiroyuki

[permalink] [raw]
Subject: Re: [PATCH] setup_per_zone_pages_min(): take zone->lock instead of zone->lru_lock

On Wed, 01 Oct 2008 19:39:32 +0200
Gerald Schaefer <[email protected]> wrote:

> From: Gerald Schaefer <[email protected]>
>
> This replaces zone->lru_lock in setup_per_zone_pages_min() with zone->lock.
> There seems to be no need for the lru_lock anymore, but there is a need for
> zone->lock instead, because that function may call move_freepages() via
> setup_zone_migrate_reserve().
>
> Signed-off-by: Gerald Schaefer <[email protected]>
>
Thank you!.

Acked-by: KAMEZAWA Hiroyuki <[email protected]>


> ---
> mm/page_alloc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> Index: linux-2.6/mm/page_alloc.c
> ===================================================================
> --- linux-2.6.orig/mm/page_alloc.c
> +++ linux-2.6/mm/page_alloc.c
> @@ -4207,7 +4207,7 @@ void setup_per_zone_pages_min(void)
> for_each_zone(zone) {
> u64 tmp;
>
> - spin_lock_irqsave(&zone->lru_lock, flags);
> + spin_lock_irqsave(&zone->lock, flags);
> tmp = (u64)pages_min * zone->present_pages;
> do_div(tmp, lowmem_pages);
> if (is_highmem(zone)) {
> @@ -4239,7 +4239,7 @@ 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 [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>

2008-10-02 10:04:31

by Yasunori Goto

[permalink] [raw]
Subject: Re: [PATCH] setup_per_zone_pages_min(): take zone->lock instead of zone->lru_lock


Thanks!

Tested-by: Yasunori Goto <[email protected]>


> From: Gerald Schaefer <[email protected]>
>
> This replaces zone->lru_lock in setup_per_zone_pages_min() with zone->lock.
> There seems to be no need for the lru_lock anymore, but there is a need for
> zone->lock instead, because that function may call move_freepages() via
> setup_zone_migrate_reserve().
>
> Signed-off-by: Gerald Schaefer <[email protected]>
>
> ---
> mm/page_alloc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> Index: linux-2.6/mm/page_alloc.c
> ===================================================================
> --- linux-2.6.orig/mm/page_alloc.c
> +++ linux-2.6/mm/page_alloc.c
> @@ -4207,7 +4207,7 @@ void setup_per_zone_pages_min(void)
> for_each_zone(zone) {
> u64 tmp;
>
> - spin_lock_irqsave(&zone->lru_lock, flags);
> + spin_lock_irqsave(&zone->lock, flags);
> tmp = (u64)pages_min * zone->present_pages;
> do_div(tmp, lowmem_pages);
> if (is_highmem(zone)) {
> @@ -4239,7 +4239,7 @@ 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 */
>
>

--
Yasunori Goto