From: Dave Chinner <david@fromorbit.com>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
Zi Yan <ziy@nvidia.com>, Barry Song <baohua@kernel.org>,
Carlos Maiolino <cem@kernel.org>,
linux-xfs@vger.kernel.org,
syzbot <syzbot+359a67b608de1ef72f65@syzkaller.appspotmail.com>,
akpm@linux-foundation.org, apopple@nvidia.com, byungchul@sk.com,
david@redhat.com, gourry@gourry.net, joshua.hahnjy@gmail.com,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
matthew.brost@intel.com, rakie.kim@sk.com,
syzkaller-bugs@googlegroups.com, ying.huang@linux.alibaba.com,
Harry Yoo <harry.yoo@oracle.com>, Michal Hocko <mhocko@suse.com>,
Matthew Wilcox <willy@infradead.org>
Subject: Re: [syzbot] [mm?] WARNING in xfs_init_fs_context
Date: Tue, 8 Jul 2025 08:10:52 +1000 [thread overview]
Message-ID: <aGxF7NqHNK7Vtd1_@dread.disaster.area> (raw)
In-Reply-To: <630b4379-751a-4bf1-a249-f2e051ec77d6@suse.cz>
On Wed, Jul 02, 2025 at 09:30:30AM +0200, Vlastimil Babka wrote:
> On 7/2/25 3:41 AM, Tetsuo Handa wrote:
> > By the way, why is xfs_init_fs_context() using __GFP_NOFAIL ?
> >
> > mp = kzalloc(sizeof(struct xfs_mount), GFP_KERNEL | __GFP_NOFAIL);
> > if (!mp)
> > return -ENOMEM;
> >
> > This looks an allocation attempt which can fail safely.
It's irrelevant - it shouldn't fail regardless of __GFP_NOFAIL being
specified.
> Indeed. Dave Chinner's commit f078d4ea82760 ("xfs: convert kmem_alloc()
> to kmalloc()") dropped the xfs wrapper. This allocation didn't use
> KM_MAYFAIL so it got __GFP_NOFAIL. The commit mentions this high-order
> nofail issue for another allocation site that had to use xlog_kvmalloc().
I don't see how high-order allocation behaviour is relevant here.
Pahole says the struct xfs_mount is 4224 bytes in length. It is an
order-1 allocation and if we've fragmented memory so badly that slab
can't allocate an order-1 page then *lots* of other stuff is going
to be stalling. (e.g. slab pages for inodes are typically order-3,
same as the kmalloc-8kk slab).
Note that the size of the structure is largely because of the
embedded cpumask for inodegc:
struct cpumask m_inodegc_cpumask; /* 3104 1024 */
This should probably be pulled out into a dynamically allocated
inodegc specific structure. Then the struct xfs_mount is only a
order-0 allocation and should never fail, regardless of
__GFP_NOFAIL being specified or not.
> I think either this allocation really can fail as the code (return
> -ENOMEM) suggests and thus can drop __GFP_NOFAIL, or it can use
> kvmalloc() - I think the wrapper for that can be removed now too after
> the discussion in [1] resulted in commit 46459154f997 ("mm: kvmalloc:
> make kmalloc fast path real fast path").
I know about that - I have patches that I'm testing that replace
xlog_kvmalloc() with kvmalloc calls.
-Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2025-07-07 22:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-29 22:47 syzbot
2025-07-01 15:01 ` Zi Yan
[not found] ` <1921ec99-7abb-42f1-a56b-d1f0f5bc1377@I-love.SAKURA.ne.jp>
2025-07-02 7:30 ` Vlastimil Babka
2025-07-04 8:26 ` Harry Yoo
2025-07-07 16:57 ` Vlastimil Babka
2025-07-07 22:10 ` Dave Chinner [this message]
2025-07-08 8:50 ` Vlastimil Babka
2025-09-28 17:44 ` syzbot
2025-09-29 6:40 ` Christoph Hellwig
2025-09-29 7:05 ` Vlastimil Babka
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=aGxF7NqHNK7Vtd1_@dread.disaster.area \
--to=david@fromorbit.com \
--cc=akpm@linux-foundation.org \
--cc=apopple@nvidia.com \
--cc=baohua@kernel.org \
--cc=byungchul@sk.com \
--cc=cem@kernel.org \
--cc=david@redhat.com \
--cc=gourry@gourry.net \
--cc=harry.yoo@oracle.com \
--cc=joshua.hahnjy@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-xfs@vger.kernel.org \
--cc=matthew.brost@intel.com \
--cc=mhocko@suse.com \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=rakie.kim@sk.com \
--cc=syzbot+359a67b608de1ef72f65@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=vbabka@suse.cz \
--cc=willy@infradead.org \
--cc=ying.huang@linux.alibaba.com \
--cc=ziy@nvidia.com \
/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