From: Hugh Dickins <hugh@veritas.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Nick Piggin <npiggin@suse.de>,
Linux Memory Management List <linux-mm@kvack.org>,
linux-fsdevel@vger.kernel.org
Subject: Re: [rfc][patch] unlock_page speedup
Date: Tue, 23 Dec 2008 00:46:51 +0000 (GMT) [thread overview]
Message-ID: <Pine.LNX.4.64.0812230038070.13610@blonde.anvils> (raw)
In-Reply-To: <alpine.LFD.2.00.0812190941120.14014@localhost.localdomain>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 2074 bytes --]
On Fri, 19 Dec 2008, Linus Torvalds wrote:
>
> That said, I did notice a problem. Namely that while the VM code is good
> about looking at ->mapping (because it doesn't know whether the page is
> anonymous or a true mapping), much of the filesystem code is _not_ careful
> about page->mapping, since the filesystem code knows a-priori that the
> mapping pointer must be an inode mapping (or we'd not have called it).
>
> So filesystems do tend to do things like
>
> struct inode *inode = page->mapping->host;
>
> and while the low bit of mapping is magic, those code-paths don't care
> because they depend on it being zero.
>
> So hiding the lock bit there would involve a lot more work than I naïvely
> expected before looking closer. We'd have to change the name (to
> "_mapping", presumably), and make all users use an accessor function to
> make code like the above do
>
> struct inode *inode = page_mapping(page)->host;
>
> or something (we migth want to have a "page_host_inode()" helper to do it,
> it seems to be the most common reason for accessing "->mapping" that
> there is.
>
> So it could be done pretty mechanically, but it's still a _big_ change.
> Maybe not worth it, unless we can really translate it into some other
> advantage (ie real simplification of page flag access)
Yes, it's messy, particularly given out-of-tree filesystems.
Perhaps there's somewhere else in the struct page you could keep the
lock bit and get the advantage you're looking for: playing with the
low bits of page->mapping is best left to anon pages.
I did have a patch to keep PG_swapcache there: that got stalled on
dreaming up enough memorable names for variants of page_mapping()
that I turned out to need, then it got buried under other work.
I'll resurrect it in the next month or so; it would be nice to
keep PG_swapbacked there too, but it's not quite as easy since
Rik's split LRU categorizes shmem/tmpfs pages as swapbacked i.e.
that flag applies to anon and also to one particular filesystem.
Hugh
next prev parent reply other threads:[~2008-12-23 0:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-19 7:29 Nick Piggin
2008-12-19 7:35 ` Andrew Morton
2008-12-19 7:53 ` Nick Piggin
2008-12-19 7:59 ` Andrew Morton
2008-12-19 8:53 ` Nick Piggin
2008-12-19 17:35 ` Linus Torvalds
2008-12-19 17:55 ` Linus Torvalds
2008-12-23 0:46 ` Hugh Dickins [this message]
2008-12-22 3:51 ` Nick Piggin
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=Pine.LNX.4.64.0812230038070.13610@blonde.anvils \
--to=hugh@veritas.com \
--cc=akpm@linux-foundation.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=npiggin@suse.de \
--cc=torvalds@linux-foundation.org \
/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