[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.1.00.1007081814420.1132@tigran.mtv.corp.google.com>
Date: Thu, 8 Jul 2010 18:28:20 -0700 (PDT)
From: Hugh Dickins <hughd@...gle.com>
To: Shaohua Li <shaohua.li@...el.com>
cc: Andrew Morton <akpm@...ux-foundation.org>,
lkml <linux-kernel@...r.kernel.org>,
linux-mm <linux-mm@...ck.org>, Andi Kleen <andi@...stfloor.org>,
"Zhang, Yanmin" <yanmin.zhang@...el.com>
Subject: Re: [PATCH]shmem: reduce one time of locking in pagefault
On Wed, 7 Jul 2010, Shaohua Li wrote:
> On Wed, Jul 07, 2010 at 09:32:54AM +0800, Andrew Morton wrote:
> >
> > The patch doesn't make shmem_getpage() any clearer :(
:)
> >
> > shmem_inode_info.lock appears to be held too much. Surely
> > lookup_swap_cache() didn't need it (for example).
> >
> > What data does shmem_inode_info.lock actually protect?
> As far as my understanding, it protects shmem swp_entry, which is most used
> to support swap. It also protects some accounting. If no swap, the lock almost
> can be removed like tiny-shmem.
That's right: shmem_info_info.lock protects what's in shmem_inode_info,
plus what hangs off it (the shmem_swp blocks).
We want that lock across the lookup_swap_cache() to be sure that what we
find is still what we want (otherwise another thread might bring it out
of swap and that swap be reused for something else) - the page lock is
good once you have a page to lock, but until then.... I guess could be
done by dropping the lock then retaking and rechecking after, but that
would go right against the grain of this patch.
Hugh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists