public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Oleg Nesterov <oleg@redhat.com>
Cc: linux-kernel@vger.kernel.org, Eric Dumazet <edumazet@google.com>,
	Frederic Weisbecker <frederic@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Waiman Long <longman@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] task_work: Consume only item at a time while invoking the callbacks.
Date: Wed, 26 Feb 2025 15:16:01 +0100	[thread overview]
Message-ID: <20250226141601.VBQ91ZDb@linutronix.de> (raw)
In-Reply-To: <20250223224014.GC23282@redhat.com>

On 2025-02-23 23:40:15 [+0100], Oleg Nesterov wrote:
> Well... I won't really argue because I can't suggest a better fix at
> least right now. Most probably never.
> 
> However, let me say that this patch doesn't make me happy ;) See below.
> 
> On 02/21, Sebastian Andrzej Siewior wrote:
> >
> > Oleg pointed out that this might be problematic if one closes 2.000.000
> > files at once. While testing this scenario by opening that many files
> > following by exit() to ensure that all files are closed at once, I did
> > not observe anything outside of noise.
> 
> and this probably means that we can revert c82199061009 ("task_work: remove
> fifo ordering guarantee") and restore the fifo ordering which IMO makes much
> more sense.

So assume that turning around will fix the problem because the cancel
callback is run first followed by the clean up.

> But:
> 
> > Fixes: c5d93d23a2601 ("perf: Enqueue SIGTRAP always via task_work.")
> 
> Yes. So, to fix this specific problem in perf this patch changes task_work.c
> 
> And after this change we can never enforce a "clear" ordering, fifo or even lifo.
> The ordering is simply "unpredictable/random".
> 
> I'll try to find and read the previous discussions tomorrow, but iirc Frederic
> had another solution?

Two at least:
- having a pointer to the next item
- avoiding the wait in the task_work callback. I think this is the
  unfortunate part. I think he had something but was very unhappy with
  it.

> Oleg.

Sebastian

  parent reply	other threads:[~2025-02-26 14:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-21 17:05 [PATCH] task_work: Consume only item at a time while invoking the callbacks Sebastian Andrzej Siewior
2025-02-23 22:40 ` Oleg Nesterov
2025-02-25 14:28   ` Frederic Weisbecker
2025-02-25 16:35     ` Oleg Nesterov
2025-02-25 22:20       ` Frederic Weisbecker
2025-02-26 13:13         ` Oleg Nesterov
2025-02-26 14:01           ` Oleg Nesterov
2025-02-26 14:42             ` Frederic Weisbecker
2025-02-26 18:36               ` Oleg Nesterov
2025-02-26 14:16   ` Sebastian Andrzej Siewior [this message]
2025-02-26 14:29     ` Oleg Nesterov
2025-02-26 14:32       ` Sebastian Andrzej Siewior
2025-02-26 12:50 ` Oleg Nesterov
2025-02-26 13:08   ` Frederic Weisbecker

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=20250226141601.VBQ91ZDb@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=edumazet@google.com \
    --cc=frederic@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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