[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1287638608.2545.98.camel@edumazet-laptop>
Date: Thu, 21 Oct 2010 07:23:28 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: Venkatesh Pallipadi <venki@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...e.hu>,
"H. Peter Anvin" <hpa@...or.com>,
Thomas Gleixner <tglx@...utronix.de>,
Balbir Singh <balbir@...ux.vnet.ibm.com>,
Martin Schwidefsky <schwidefsky@...ibm.com>,
linux-kernel@...r.kernel.org, Paul Turner <pjt@...gle.com>,
Shaun Ruffell <sruffell@...ium.com>,
Yong Zhang <yong.zhang0@...il.com>
Subject: Re: [PATCH 1/6] Free up pf flag PF_KSOFTIRQD
Le mercredi 20 octobre 2010 à 15:48 -0700, Venkatesh Pallipadi a écrit :
> +int is_ksoftirqd_context(void)
> +{
> + return (current == __get_cpu_var(ksoftirqd));
> +}
"return (X == Y);" should be "return X == Y;"
I believe this function should be inlined, and use this_cpu_read()
You probably can pass 'current' as a pointer.
static inline bool is_ksoftirq(struct task_struct *p)
{
return p == this_cpu_read(ksoftirqd);
}
Your version is a bit expensive :
<is_ksoftirqd_context>:
55 push %rbp
48 89 e5 mov %rsp,%rbp
48 83 ec 10 sub $0x10,%rsp
48 89 1c 24 mov %rbx,(%rsp)
4c 89 64 24 08 mov %r12,0x8(%rsp)
48 c7 c3 40 03 01 00 mov $0x10340,%rbx
e8 93 e5 24 00 callq ffffffff812aeab0 <debug_smp_processor_id>
89 c0 mov %eax,%eax
48 8b 04 c5 a0 b8 b5 mov -0x7e4a4760(,%rax,8),%rax
81
65 4c 8b 24 25 00 cc mov %gs:0xcc00,%r12
00 00
4c 39 24 18 cmp %r12,(%rax,%rbx,1)
48 8b 1c 24 mov (%rsp),%rbx
4c 8b 64 24 08 mov 0x8(%rsp),%r12
c9 leaveq
0f 94 c0 sete %al
0f b6 c0 movzbl %al,%eax
c3 retq
While alternate version :
cmp %gs:0x10340,%rdi
(So it should be as fast as previous flag based test)
Thanks
--
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