From: Dave Chinner <david@fromorbit.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Michal Hocko <mhocko@kernel.org>,
Guenter Roeck <linux@roeck-us.net>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Christoph Lameter <cl@linux.com>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
linux-mm@kvack.org
Subject: Re: linux-next: kernel BUG at mm/slub.c:1447!
Date: Tue, 6 Oct 2015 16:12:18 +1100 [thread overview]
Message-ID: <20151006051218.GB32150@dastard> (raw)
In-Reply-To: <20151005191217.48008dc7.akpm@linux-foundation.org>
On Mon, Oct 05, 2015 at 07:12:17PM -0700, Andrew Morton wrote:
> On Mon, 5 Oct 2015 12:29:36 -0700 Andrew Morton <akpm@linux-foundation.org> wrote:
>
> > Maybe it would be better to add the gfp_t argument to the
> > address_space_operations. At a minimum, writepage(), readpage(),
> > writepages(), readpages(). What a pickle.
>
> I'm being dumb. All we need to do is to add a new
>
> address_space_operations.readpage_gfp(..., gfp_t gfp)
>
> etc. That should be trivial. Each fs type only has 2-4 instances of
> address_space_operations so the overhead is miniscule.
>
> As a background janitorial thing we can migrate filesystems over to the
> new interface then remove address_space_operations.readpage() etc. But
> this *would* add overhead: more stack and more text for no gain. So
> perhaps we just leave things as they are.
>
> That's so simple that I expect we can short-term fix this bug with that
> approach. umm, something like
>
> --- a/fs/mpage.c~a
> +++ a/fs/mpage.c
> @@ -139,7 +139,8 @@ map_buffer_to_page(struct page *page, st
> static struct bio *
> do_mpage_readpage(struct bio *bio, struct page *page, unsigned nr_pages,
> sector_t *last_block_in_bio, struct buffer_head *map_bh,
> - unsigned long *first_logical_block, get_block_t get_block)
> + unsigned long *first_logical_block, get_block_t get_block,
> + gfp_t gfp)
Simple enough, but not sufficient to avoid deadlocks because this
doesn't address the common vector for deadlock that was reported.
i.e. deadlocks due to the layering dependency the loop device
creates between two otherwise independent filesystems.
If read IO through the loop device does GFP_KERNEL allocations, then
it is susceptible to deadlock as that can force writeback and
transactions from the filesystem on top of the loop device, which
does more IO to the loop device, which then backs up on the backing
file inode mutex. Forwards progress cannot be made until the
GFP_KERNEL allocation succeeds, but that depends on the loop device
making forwards progress...
The loop device indicates this is a known problems tries to avoid
these deadlocks by doing this on it's backing file:
mapping_set_gfp_mask(mapping, lo->old_gfp_mask & ~(__GFP_IO|__GFP_FS))
to try to ensure that mapping related allocations do not cause
inappropriate reclaim contexts to be triggered.
This is a problem independent of any specific filesystem - let's not
hack a workaround into a specific filesystem just because the
problem was reported on that filesystem....
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2015-10-06 5:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <560D59F7.4070002@roeck-us.net>
2015-10-01 20:49 ` Andrew Morton
2015-10-02 7:25 ` Michal Hocko
2015-10-02 8:53 ` Michal Hocko
2015-10-02 20:49 ` Andrew Morton
2015-10-05 13:47 ` Michal Hocko
2015-10-05 19:29 ` Andrew Morton
2015-10-06 2:12 ` Andrew Morton
2015-10-06 5:12 ` Dave Chinner [this message]
2015-10-02 13:36 ` Guenter Roeck
2015-10-02 13:42 ` Michal Hocko
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=20151006051218.GB32150@dastard \
--to=david@fromorbit.com \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux@roeck-us.net \
--cc=mhocko@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