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]
Date:	Wed, 25 Jun 2008 10:36:13 -0400 (EDT)
From:	Mikulas Patocka <mpatocka@...hat.com>
To:	Denys Vlasenko <vda.linux@...glemail.com>
cc:	linux-kernel@...r.kernel.org, sparclinux@...r.kernel.org,
	davem@...emloft.net
Subject: Re: [3/10 PATCH] inline wake_up_bit

On Wed, 25 Jun 2008, Denys Vlasenko wrote:

> On Tuesday 24 June 2008 07:57, Mikulas Patocka wrote:
>> Inline wake_up_bit. The function just pases arguments around.
>>
>> Signed-off-by: Mikulas Patocka <mpatocka@...hat.com>
>>
>>   int __wait_on_bit_lock(wait_queue_head_t *, struct wait_bit_queue *, int (*)(void *), unsigned);
>> -void wake_up_bit(void *, int);
>>   int out_of_line_wait_on_bit(void *, int, int (*)(void *), unsigned);
>
>> +static __always_inline void wake_up_bit(void *word, int bit)
>> +{
>> +	__wake_up_bit(bit_waitqueue(word, bit), word, bit);
>> +}
>
> So now every call to wake_up_bit(word, bit) now is converted to:
>
> __wake_up_bit(bit_waitqueue(word, bit), word, bit);
>
> which is in turn converted to (looking into your next patch):
>
> {
>       wait_queue_head_t *wq = bit_waitqueue(word, bit);
>       struct wait_bit_key key = __WAIT_BIT_KEY_INITIALIZER(word, bit);
>       if (waitqueue_active(wq))
>               __wake_up(wq, TASK_NORMAL, 1, &key);
> }
>
> which is in turn converted to (looking into your other patch):
>
> {
>       wait_queue_head_t *wq = bit_waitqueue(word, bit);
>       struct wait_bit_key key = __WAIT_BIT_KEY_INITIALIZER(word, bit);
>       if (waitqueue_active(wq))
>               {
>                      unsigned long flags;
>                      spin_lock_irqsave(&qw->lock, flags);
>                      __wake_up_common(wq, TASK_NORMAL, 1, 0, &key);
>                      spin_unlock_irqrestore(&wq->lock, flags);
>               }
> }
>
> And you know what? This is likely not the end yet! It's possible
> spin_lock_irqXXX, __wake_up_common, waitqueue_active or bit_waitqueue
> are inlines - I didn't check.
> --
> vda

Yes, that's 0.2% code size increase (or none increase, if drop 
inline-__wake_up_bit.patch and apply only the other patches). To me it 
seems crazy, how this code was refactored again and again over time, up to 
8 levels of functions (including passing a pointer to a method). In 2.0.x 
kernel series, it was just a single call to wake up a queue.

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