From: Andrew Morton <akpm@osdl.org>
To: Christoph Lameter <clameter@engr.sgi.com>
Cc: kamezawa.hiroyu@jp.fujitsu.com, cpw@sgi.com,
linux-kernel@vger.kernel.org, lhms-devel@lists.sourceforge.net,
taka@valinux.co.jp
Subject: Re: [PATCH 5/5] Direct Migration V9: Avoid writeback / page_migrate() method
Date: Tue, 10 Jan 2006 22:49:05 -0800 [thread overview]
Message-ID: <20060110224905.514213de.akpm@osdl.org> (raw)
In-Reply-To: <Pine.LNX.4.62.0601102225550.20806@schroedinger.engr.sgi.com>
Christoph Lameter <clameter@engr.sgi.com> wrote:
>
> On Tue, 10 Jan 2006, Andrew Morton wrote:
>
> > Christoph Lameter <clameter@sgi.com> wrote:
> > >
> > > + spin_lock(&mapping->private_lock);
> > > +
> > > + bh = head;
> > > + do {
> > > + get_bh(bh);
> > > + lock_buffer(bh);
> > > + bh = bh->b_this_page;
> > > +
> > > + } while (bh != head);
> > > +
> >
> > Guys, lock_buffer() sleeps and cannot be called inside spinlock.
>
> I took it the way it was in the hotplug patches.We are taking the
> spinlock here to protect the scan over the list of bh's of this page
> right?
>
> Is it not sufficient to have the page locked to guarantee that the list of
> buffers is not changed? Seems that ext3 does that (see
> ext3_ordered_writepage() etc).
Yes, the page lock protects the buffer ring.
> like this?
>
> Index: linux-2.6.15/fs/buffer.c
> ===================================================================
> --- linux-2.6.15.orig/fs/buffer.c 2006-01-10 22:13:37.000000000 -0800
> +++ linux-2.6.15/fs/buffer.c 2006-01-10 22:37:28.000000000 -0800
> @@ -3070,8 +3070,6 @@ int buffer_migrate_page(struct page *new
> if (migrate_page_remove_references(newpage, page, 3))
> return -EAGAIN;
>
> - spin_lock(&mapping->private_lock);
> -
> bh = head;
> do {
> get_bh(bh);
> @@ -3094,11 +3092,9 @@ int buffer_migrate_page(struct page *new
> } while (bh != head);
>
> SetPagePrivate(newpage);
> - spin_unlock(&mapping->private_lock);
>
> migrate_page_copy(newpage, page);
>
> - spin_lock(&mapping->private_lock);
> bh = head;
> do {
> unlock_buffer(bh);
> @@ -3106,7 +3102,6 @@ int buffer_migrate_page(struct page *new
> bh = bh->b_this_page;
>
> } while (bh != head);
> - spin_unlock(&mapping->private_lock);
>
> return 0;
> }
Seems right, I think.
So let's see. Suppose the kernel is about to dink with a page's buffer
ring. It does:
get_page(page);
lock_page(page);
dink_with(page_buffers(page));
how do these patches ensure that the page doesn't get migrated under my
feet?
next prev parent reply other threads:[~2006-01-11 6:49 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-10 22:41 [PATCH 0/5] Direct Migration V9: Overview Christoph Lameter
2006-01-10 22:41 ` [PATCH 1/5] Direct Migration V9: PageSwapCache checks Christoph Lameter
2006-01-10 22:41 ` [PATCH 2/5] Direct Migration V9: migrate_pages() extension Christoph Lameter
2006-01-11 5:46 ` Andrew Morton
2006-01-12 3:25 ` Christoph Lameter
2006-01-10 22:41 ` [PATCH 3/5] Direct Migration V9: remove_from_swap() to remove swap ptes Christoph Lameter
2006-01-10 22:41 ` [PATCH 4/5] Direct Migration V9: upgrade MPOL_MF_MOVE and sys_migrate_pages() Christoph Lameter
2006-01-10 22:41 ` [PATCH 5/5] Direct Migration V9: Avoid writeback / page_migrate() method Christoph Lameter
2006-01-11 6:03 ` Andrew Morton
2006-01-11 6:38 ` Christoph Lameter
2006-01-11 6:49 ` Andrew Morton [this message]
2006-01-11 6:52 ` Christoph Lameter
2006-01-11 6:25 ` Andrew Morton
2006-01-11 3:26 ` [PATCH 0/5] Direct Migration V9: Overview KAMEZAWA Hiroyuki
2006-01-11 6:10 ` Christoph Lameter
2006-01-11 6:18 ` Christoph Lameter
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=20060110224905.514213de.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=clameter@engr.sgi.com \
--cc=cpw@sgi.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=lhms-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=taka@valinux.co.jp \
/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
Powered by JetHome