All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: syzbot <syzbot+fe0c72f0ccbb93786380@syzkaller.appspotmail.com>,
	syzkaller-bugs@googlegroups.com, Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org, linux-mm <linux-mm@kvack.org>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH] debugobject: don't wake up kswapd from fill_pool()
Date: Sat, 13 May 2023 10:33:47 +0200	[thread overview]
Message-ID: <87lehsaavo.ffs@tglx> (raw)
In-Reply-To: <61d7ac52-3352-b7cd-8908-890a29a007d9@I-love.SAKURA.ne.jp>

On Sat, May 13 2023 at 08:13, Tetsuo Handa wrote:
> On 2023/05/13 3:07, Thomas Gleixner wrote:
>> The main change is to make the refill invocation conditional when the
>> lookup fails. That's how that code has been from day one.
>
> Making refill conditional helps reducing frequency of doing allocations.
> I want a proof that allocations never happens in the worst scenario.
>
> Are you saying that some debugobject function other than debug_object_activate()
> guarantees that memory for that object was already allocated before
> debug_object_activate() is called for the first time for that object,
> _and_ such debugobject function is called without locks held?

The point is that the allocation in activate() only happens when the
tracked entity was not initialized _before_ activate() is invoked.

That's a bug for dynamically allocated entities, but a valid scenario
for statically initialized entities as they can be activated without
prior init() obviously.

For dynamically allocated entities the init() function takes care of the
tracking object allocation and that's where the pool is refilled. So for
those the lookup will never fail.

Now I just stared at __alloc_pages_slowpath() and looked at the
condition for wakeup_all_kswapds(). ALLOC_KSWAPD is set because
debugobject uses GFP_ATOMIC which contains __GFP_KSWAPD_RECLAIM.

So debug objects needs to have s/GFP_ATOMIC/__GFP_HIGH/ to prevent that
wakeup path.

Thanks,

        tglx




  reply	other threads:[~2023-05-13  8:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-10 22:10 [syzbot] [kernel?] possible deadlock in __mod_timer (2) syzbot
2023-05-11 13:47 ` [PATCH] debugobject: don't wake up kswapd from fill_pool() Tetsuo Handa
2023-05-12  3:44   ` Andrew Morton
2023-05-12 10:57     ` Tetsuo Handa
2023-05-12 12:54       ` Thomas Gleixner
2023-05-12 13:09         ` Tetsuo Handa
2023-05-12 18:07           ` Thomas Gleixner
2023-05-12 23:13             ` Tetsuo Handa
2023-05-13  8:33               ` Thomas Gleixner [this message]
2023-05-13  9:33                 ` Tetsuo Handa
2023-05-13 19:42                   ` Thomas Gleixner
2023-05-22 12:56   ` [tip: core/debugobjects] debugobjects: Don't " tip-bot2 for Tetsuo Handa

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=87lehsaavo.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@elte.hu \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=peterz@infradead.org \
    --cc=syzbot+fe0c72f0ccbb93786380@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.