From: Yasunori Goto <y-goto@jp.fujitsu.com>
To: gerald.schaefer@de.ibm.com
Cc: Andy Whitcroft <apw@shadowen.org>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com,
Mel Gorman <mel@csn.ul.ie>,
Andrew Morton <akpm@linux-foundation.org>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Subject: Re: setup_per_zone_pages_min(): zone->lock vs. zone->lru_lock
Date: Tue, 30 Sep 2008 10:53:41 +0900 [thread overview]
Message-ID: <20080930103748.44A3.E1E9C6FF@jp.fujitsu.com> (raw)
In-Reply-To: <20080930094017.5ed2938a.kamezawa.hiroyu@jp.fujitsu.com>
> On Mon, 29 Sep 2008 23:20:05 +0200
> Gerald Schaefer <gerald.schaefer@de.ibm.com> wrote:
>
> > On Mon, 2008-09-29 at 18:36 +0100, Andy Whitcroft wrote:
> > > The allocator protects it freelists using zone->lock (as we can see in
> > > rmqueue_bulk), so anything which manipulates those should also be using
> > > that lock. move_freepages() is scanning the cmap and picking up free
> > > pages directly off the free lists, it is expecting those lists to be
> > > stable; it would appear to need zone->lock. It does look like
> > > setup_per_zone_pages_min() is holding the wrong thing at first look.
> >
> > I just noticed that the spin_lock in that function is much older than the
> > call to setup_zone_migrate_reserve(), which then calls move_freepages().
> > So it seems that the zone->lru_lock there does (did?) have another purpose,
> > maybe protecting zone->present_pages/pages_min/etc.
> >
> Maybe.
The zone->lru_lock() have been used before memory hotplug code was
implemented. But I can't find any reason why it have been used.
>
> > Looks like the need for a zone->lock (if any) was added later, but I'm not
> > sure if makes sense to take both locks together, or if the lru_lock is still
> > needed at all.
> >
> At first look, replacing zone->lru_lock with zone->lock is enough...
> This function is an only one function which use zone->lru_lock in page_alloc.c
> And zone_watermark_ok() which access zone->pages_min/low/high is not under any
> locks. So, taking zone->lru_lock here doesn't seem to be necessary...
I agree.
Bye.
--
Yasunori Goto
next prev parent reply other threads:[~2008-09-30 1:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-29 17:10 setup_per_zone_pages_min(): zone->lock vs. zone->lru_lock Gerald Schaefer
2008-09-29 17:36 ` Andy Whitcroft
2008-09-29 21:20 ` Gerald Schaefer
2008-09-30 0:40 ` KAMEZAWA Hiroyuki
2008-09-30 1:53 ` Yasunori Goto [this message]
2008-10-01 17:39 ` [PATCH] setup_per_zone_pages_min(): take zone->lock instead of zone->lru_lock Gerald Schaefer
2008-10-02 5:49 ` KAMEZAWA Hiroyuki
2008-10-02 10:00 ` Yasunori Goto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080930103748.44A3.E1E9C6FF@jp.fujitsu.com \
--to=y-goto@jp.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=apw@shadowen.org \
--cc=gerald.schaefer@de.ibm.com \
--cc=heiko.carstens@de.ibm.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mel@csn.ul.ie \
--cc=schwidefsky@de.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).