[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y3tVPjAjE9OFRLaP@hirez.programming.kicks-ass.net>
Date: Mon, 21 Nov 2022 11:38:54 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Waiman Long <longman@...hat.com>
Cc: Ingo Molnar <mingo@...hat.com>, Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>,
Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Phil Auld <pauld@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH-tip] sched: Don't call kfree() in do_set_cpus_allowed()
On Fri, Nov 18, 2022 at 02:33:02PM -0500, Waiman Long wrote:
> Commit 851a723e45d1 ("sched: Always clear user_cpus_ptr in
> do_set_cpus_allowed()") may call kfree() if user_cpus_ptr was previously
> set. Unfortunately, some of the callers of do_set_cpus_allowed()
'some' ? There's only 3 or so, which one triggers this?
> may not be in a context where kfree() can be safely called. So the
> following splats may be printed:
>
> WARNING: possible circular locking dependency detected
> BUG: sleeping function called from invalid context
>
> To avoid these problems without leaking memory, the free cpumask is now
> put into a lockless list to be reused in a later sched_setaffinity()
> call instead.
Urgh.. depending on which of the callsites it is, it's probably simpler
to just rework the caller to not use do_set_cpus_allowed(), no?
Powered by blists - more mailing lists