From: Andreas Dilger <adilger@dilger.ca>
To: Andi Kleen <andi@firstfloor.org>
Cc: Josef Bacik <josef@redhat.com>,
linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 2/2] Btrfs: load the key from the dir item in readdir into a fake dentry
Date: Thu, 26 May 2011 14:45:32 -0600 [thread overview]
Message-ID: <F08E6AE7-4C97-49AB-A99C-FE22D099FA05@dilger.ca> (raw)
In-Reply-To: <20110526200338.GH4065@one.firstfloor.org>
On May 26, 2011, at 14:03, Andi Kleen wrote:
> On Thu, May 26, 2011 at 03:02:42PM -0400, Josef Bacik wrote:
>> + /*
>> + * If this dentry needs lookup, don't set the referenced flag so that it
>> + * is more likely to be cleaned up by the dcache shrinker in case of
>> + * memory pressure.
>> + */
>> + if (!d_need_lookup(dentry))
>> + dentry->d_flags |= DCACHE_REFERENCED;
>
> No it doesn't at all. The allocation will just push everything else
> out.
>
> Really you cannot view this by only looking at the dcache.
> You have to look at the complete VM behaviour. All the caches
> and the other memory interact.
Even without this patch, if you are doing "find /" there will be considerable memory pressure from all of the pages that are accessed by readdir(), and to a lesser extent the directory dentry/inode entries. I'm not sure whether the issue you raise is going to be significant in the end or not.
Taking this development a bit further, I've long thought it would be quite interesting if these dcache entries could be linked into a readdir-ordered linked list, and then discard the actual directory pages from cache entirely. This would potentially allow later readdir operations to work just by walking the readdir-ordered linked list and not touching the page cache at all.
Since normal operations like "ls -l" currently instantiate both a pagecache for readdir, and a dentry for each dirent, it could potentially even reduce memory if there was no a need to keep the directory pages in cache anymore.
>>> d_alloc uses a normal GFP_KERNEL, which is quite in appropiate for this.
>>>
>>> It should at least reclaim and probably more, but even then it's
>>> risky.
>>>
>>
>> Ah yeah I guess I should have probably used GFP_KERNEL. Sorry about that,
>
> GFP_KERNEL is already used, but it's wrong. I'm not sure any
> of the existing GFP_* flags will give you the semantics you
> need in fact. The new flag Minchan added for readahead may come
> near, but even that is probably not enough.
>
> -Andi
>
> --
> ak@linux.intel.com -- Speaking for myself only.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
Cheers, Andreas
next prev parent reply other threads:[~2011-05-26 20:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <adilger@dilger.ca, hch@lst.de>
2011-05-26 14:48 ` [PATCH 1/2] fs: add a DCACHE_NEED_LOOKUP flag for d_flags Josef Bacik
2011-05-26 14:48 ` [PATCH 2/2] Btrfs: load the key from the dir item in readdir into a fake dentry Josef Bacik
2011-05-26 18:50 ` Andi Kleen
2011-05-26 19:02 ` Josef Bacik
2011-05-26 20:03 ` Andi Kleen
2011-05-26 20:18 ` Josef Bacik
2011-05-26 20:45 ` Andreas Dilger [this message]
2011-05-19 17:58 [PATCH 1/2] fs: add a DCACHE_NEED_LOOKUP flag for d_flags Josef Bacik
2011-05-19 17:58 ` [PATCH 2/2] Btrfs: load the key from the dir item in readdir into a fake dentry Josef Bacik
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=F08E6AE7-4C97-49AB-A99C-FE22D099FA05@dilger.ca \
--to=adilger@dilger.ca \
--cc=andi@firstfloor.org \
--cc=josef@redhat.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).