linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Jules Irenge <jbi.octave@gmail.com>
Cc: linux-kernel@vger.kernel.org, boqun.feng@gmail.com,
	Thomas Gleixner <tglx@linutronix.de>,
	Jiri Kosina <jkosina@suse.cz>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	Ingo Molnar <mingo@kernel.org>, Qian Cai <cai@lca.pw>,
	Eiichi Tsukata <devel@etsukata.com>,
	Pavankumar Kondeti <pkondeti@codeaurora.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Tyler Hicks <tyhicks@canonical.com>
Subject: Re: [PATCH 1/1] cpu: Add annotation inside clear_tasks_mm_cpumask()
Date: Thu, 16 Apr 2020 00:25:45 +0200	[thread overview]
Message-ID: <20200415222545.GN2483@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <20200415184937.32373-2-jbi.octave@gmail.com>

On Wed, Apr 15, 2020 at 07:49:37PM +0100, Jules Irenge wrote:
> Sparse reports a warning
> 
> warning: context imbalance in clear_tasks_mm_cpumask() - different lock contexts for basic block

Does this sparse crap actually ever catch a real problem, or does it
only result in horrible code like this?

> The root cause is the missing annotation inside clear_tasks_mm_cpumask()
> 
> Add the missing __acquire(&t->alloc_lock) annotation.

That's just wrong; the actual cause is find_lock_task_mm() not being
annotated, and the reason for that is because __cond_lock() is a
horrible piece of crap.

Barring any evidence that these annotations actually help anybody, can't
we just remove it all instead of making an ever bigger mess of things?

> Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
> ---
>  kernel/cpu.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/kernel/cpu.c b/kernel/cpu.c
> index 9c706af713fb..d8c452a8dd09 100644
> --- a/kernel/cpu.c
> +++ b/kernel/cpu.c
> @@ -834,6 +834,7 @@ void clear_tasks_mm_cpumask(int cpu)
>  		t = find_lock_task_mm(p);
>  		if (!t)
>  			continue;
> +		__acquire(&t->alloc_lock);
>  		cpumask_clear_cpu(cpu, mm_cpumask(t->mm));
>  		task_unlock(t);
>  	}
> -- 
> 2.24.1
> 

      reply	other threads:[~2020-04-15 22:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-15 18:49 [PATCH 0/1] Fix context imbalance warning Jules Irenge
2020-04-15 18:49 ` [PATCH 1/1] cpu: Add annotation inside clear_tasks_mm_cpumask() Jules Irenge
2020-04-15 22:25   ` Peter Zijlstra [this message]

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=20200415222545.GN2483@worktop.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=arnd@arndb.de \
    --cc=boqun.feng@gmail.com \
    --cc=cai@lca.pw \
    --cc=devel@etsukata.com \
    --cc=jbi.octave@gmail.com \
    --cc=jkosina@suse.cz \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=pkondeti@codeaurora.org \
    --cc=tglx@linutronix.de \
    --cc=tyhicks@canonical.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;
as well as URLs for NNTP newsgroup(s).