lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTi=QyTJ0vZ=U3Ts7bB-DGvtTuQ_M6k8igkKiv6EE@mail.gmail.com>
Date:	Thu, 21 Oct 2010 07:36:49 -0700
From:	Venkatesh Pallipadi <venki@...gle.com>
To:	Eric Dumazet <eric.dumazet@...il.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

On Wed, Oct 20, 2010 at 10:23 PM, Eric Dumazet <eric.dumazet@...il.com> wrote:
> 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);
> }

Yes. I thought about static inline part. The reason I did not make
this static inline was because ksoftirqd was declared static in
softirq.c and this function was getting called from sched.c.

I did not know that this_cpu_read existed though. I guess I should be
looking at using that elsewhere in the patchset too.

Also, part of the overhead you see below I think is coming from
DEBUG_PREEMPT. That would be making every smp_processor_id() call more
expensive. No?

Thanks,
Venki

>
> 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

Powered by Openwall GNU/*/Linux Powered by OpenVZ