From: Andrew Morton <akpm@digeo.com>
To: Hugh Dickins <hugh@veritas.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] swap 13/13 may_enter_fs?
Date: Wed, 26 Mar 2003 16:31:45 -0800 [thread overview]
Message-ID: <20030326163145.22c90521.akpm@digeo.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0303261649020.1315-100000@localhost.localdomain>
Hugh Dickins <hugh@veritas.com> wrote:
>
> On Tue, 25 Mar 2003, Andrew Morton wrote:
> >
> > For example, a memory-backed filesystem may be trying to allocate GFP_NOFS
> > memory while holding filesystem locks which are taken by its writepage.
> >
> > How about adding a new field to backing_dev_info for this case? Damned if I
> > can think of a name for it though.
>
> I think you're overcomplicating it. Of the existing memory_backed bdis
> (ramdisk, hugetlbfs, ramfs, sysfs, tmpfs, swap) only two have non-NULL
> writepage, and both of those two go (indirectly and directly) to swap
> (and neither holds FS lock while waiting to allocate memory).
But this is a much nicer patch. Thanks for doing all this btw. I was
barfing at ?:, not your code ;)
> If we were looking for a correct solution, I don't think backing_dev_info
> would be the right place: we're talking about GFP_ needed for writepage,
> which should be specified in the struct address_space filled in by the
> FS: I think it's more a limitation of the FS than its backing device.
Good point.
> + bdi = mapping->backing_dev_info;
> + if (bdi->swap_backed)
> + gfp_needed_for_writepage = __GFP_IO;
> + else
> + gfp_needed_for_writepage = __GFP_FS;
> + if (!(gfp_mask & gfp_needed_for_writepage))
This is inaccurate? shmem_writepage() performs no IO and could/should be
called even for GFP_NOIO allocations.
It's probably not very important but if we're going to make a change it may
as well be the right one.
Could you live with
if (bdi->has_special_writepage)
gfp_needed_for_writepage = bfi->gfp_needed_for_writepage;
? So swap_backing_dev_info uses __GFP_IO and shmem_backing_dev_info() (which
is competely atomic) uses zero?
Yeah, it's a bit awkward. I'm OK with the special-casing. Both swap and
tmpfs _are_ special, and unique. Recognising that fact in vmscan.c is
reasonable. ->gfp_needed_for_writepage should probably be in the superblock,
but that's just too far away.
> - int memory_backed; /* Cannot clean pages with writepage */
> + unsigned int
> + memory_backed:1,/* Do not count its dirty pages in nr_dirty */
> + swap_backed:1; /* Its memory_backed writepage goes to swap */
> };
Hard call. It is a tradeoff between icache misses and dcache misses.
Obviously that is trivia in this case.
next prev parent reply other threads:[~2003-03-26 22:16 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-25 22:10 [PATCH] swap 01/13 no SWAP_ERROR Hugh Dickins
2003-03-25 22:12 ` [PATCH] swap 02/13 !CONFIG_SWAP try_to_unmap Hugh Dickins
2003-03-25 22:13 ` [PATCH] swap 03/13 add_to_swap_cache Hugh Dickins
2003-03-25 22:13 ` [PATCH] swap 04/13 page_convert_anon -ENOMEM Hugh Dickins
2003-03-25 22:14 ` [PATCH] swap 05/13 page_convert_anon unlocking Hugh Dickins
2003-03-25 22:15 ` [PATCH] swap 06/13 wrap below vm_start Hugh Dickins
2003-03-25 22:17 ` [PATCH] swap 07/13 objrmap page_table_lock Hugh Dickins
2003-03-25 22:18 ` [PATCH] swap 08/13 rmap comments Hugh Dickins
2003-03-25 22:19 ` [PATCH] swap 09/13 tmpfs truncation Hugh Dickins
2003-03-25 22:20 ` [PATCH] swap 10/13 tmpfs atomics Hugh Dickins
2003-03-26 0:50 ` Andrew Morton
2003-03-25 22:21 ` [PATCH] swap 11/13 fix unuse_pmd fixme Hugh Dickins
2003-03-25 22:38 ` William Lee Irwin III
2003-03-25 22:22 ` [PATCH] swap 12/13 vm_enough_memory double counts Hugh Dickins
2003-03-25 22:23 ` [PATCH] swap 13/13 may_enter_fs? Hugh Dickins
2003-03-26 1:12 ` Andrew Morton
2003-03-26 17:22 ` Hugh Dickins
2003-03-27 0:31 ` Andrew Morton [this message]
2003-03-27 15:21 ` Hugh Dickins
2003-03-26 18:06 ` Bill Davidsen
2003-03-26 18:42 ` Hugh Dickins
2003-03-27 14:55 ` Bill Davidsen
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=20030326163145.22c90521.akpm@digeo.com \
--to=akpm@digeo.com \
--cc=hugh@veritas.com \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®