From: Andrew Morton <akpm@linux-foundation.org>
To: Andy Grover <andy.grover@oracle.com>
Cc: linux-mm@kvack.org, rds-devel@oss.oracle.com
Subject: Re: [RESEND PATCH] mm: Use spin_lock_irqsave in __set_page_dirty_nobuffers
Date: Mon, 24 Jan 2011 17:44:55 -0800 [thread overview]
Message-ID: <20110124174455.8994d8cf.akpm@linux-foundation.org> (raw)
In-Reply-To: <4D3E27B3.5050707@oracle.com>
On Mon, 24 Jan 2011 17:30:27 -0800 Andy Grover <andy.grover@oracle.com> wrote:
> > Running lock_page() against multiple pages is problematic because it
> > introduces a risk of ab/ba deadlocks against another thread which is
> > also locking multiple pages. Possible solutions are a) take some
> > higher-level mutex so that only one thread will ever be running the
> > lock_page()s at a time or b) lock all the pages in ascending
> > paeg_to_pfn() order. Both of these are a PITA.
>
> Another problem may be that lock/unlock_page() doesn't nest.
Not against the same page, no. It's functionally the same as
mutex_lock/unlock, only lockdep doesn't know about lock_page().
> We need to
> be able to handle multiple ops to the same page. So, sounds like we also
> need to keep track of all pages we lock/dirty and make sure they aren't
> unlocked as long as we have references against them?
It sounds like it. Also need to address the ab/ba issue with multiple
lock_page()s in a single thread.
I don't *think* there's any other site in the kernel which locks
multiple pages like this. Adopting the convention of "lock them in
ascending pfn order" will be OK, I think.
> I just want to fully understand what's needed, before writing at least 2
> PITA's worth of extra code :)
>
> > Some thought is needed regarding anonymous pages and swapcache pages.
>
> I think the common case for us is IO into anon pages.
lock_page() will presumably keep the swapcache manipulations happy.
We'd also need to think about the implications of pte-dirtiness and
maybe rmap walks when dealing with non-cpu-initiated dirtyings. "do
what fs/direct-io.c does" would be a good starting point.
Actually, fs/direct-io.c gets away without locking the pages.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2011-01-25 1:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-11 6:15 [RESEND PATCH] mm: Use spin_lock_irqsave in __set_page_dirty_nobuffers Andy Grover
2011-01-21 8:18 ` Andrew Morton
2011-01-21 19:25 ` Andy Grover
2011-01-21 20:09 ` Andrew Morton
2011-01-25 1:30 ` Andy Grover
2011-01-25 1:44 ` Andrew Morton [this message]
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=20110124174455.8994d8cf.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=andy.grover@oracle.com \
--cc=linux-mm@kvack.org \
--cc=rds-devel@oss.oracle.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).