[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130910152549.GH31370@twins.programming.kicks-ass.net>
Date: Tue, 10 Sep 2013 17:25:49 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Ingo Molnar <mingo@...nel.org>,
Andi Kleen <ak@...ux.intel.com>, Peter Anvin <hpa@...or.com>,
Mike Galbraith <bitbucket@...ine.de>,
Thomas Gleixner <tglx@...utronix.de>,
Arjan van de Ven <arjan@...ux.intel.com>,
Frederic Weisbecker <fweisbec@...il.com>,
linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org
Subject: Re: [PATCH 6/7] sched, x86: Provide a per-cpu preempt_count
implementation
On Tue, Sep 10, 2013 at 07:02:51AM -0700, Eric Dumazet wrote:
> On Tue, 2013-09-10 at 15:08 +0200, Peter Zijlstra wrote:
>
> > +static __always_inline int preempt_count(void)
> > +{
> > + return __this_cpu_read_4(__preempt_count) & ~PREEMPT_NEED_RESCHED;
> > +}
>
> Not sure why you used the _4 prefix on all accessors ?
Last time I tried using the proper this_cpu* stuff that all exploded in
my face due to header recursion hell, so I've limited myself to what's
available in arch/x86/include/asm/percpu.h.
It was a few weeks ago though and maybe I just didn't try hard enough.
> > +#ifdef CONFIG_PREEMPT_COUNT
> > + /*
> > + * If it were not for PREEMPT_ACTIVE we could guarantee that the
> > + * preempt_count of all tasks was equal here and this would not be
> > + * needed.
> > + */
> > + task_thread_info(prev_p)->saved_preempt_count = __raw_get_cpu_var(__preempt_count);
>
> this_cpu_read(__preempt_count) ?
>
> > + __raw_get_cpu_var(__preempt_count) = task_thread_info(next_p)->saved_preempt_count;
>
> this_cpu_write(__preempt_count,
> task_thread_info(next_p)->saved_preempt_count;
OK, that does indeed generate slightly better code.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists