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:   Thu, 7 Dec 2017 09:38:20 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     Rodrigo Siqueira <rodrigosiqueiramelo@...il.com>
Cc:     kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Scheduler: Removed first parameter from
 prepare_lock_switch

On Wed, Dec 06, 2017 at 09:50:19PM -0200, Rodrigo Siqueira wrote:
> > Yes, this is correct. However it had me looking at that code and pretty
> > much everything else is completely wrong :-)
> > 
> > That is, its functionally correct (probably), but the function name is
> > not descriptive of what the function does and the comment is just plain
> > wrong.
> > 
> > Also, since both functions are only used in core.c we should probably
> > move them there.
> 
> I'm not sure I understood it completely. What do you mean for wrong? Will 
> CONFIG_SMP a meaningless check here?

So the actual effective code is ok; including the #ifdef for SMP. But
the comment is complete nonsense.

Look at the comments:

 - in finish_lock_switch() doing smp_store_release()
 - before try_to_wake_up() describing migration/blocking
 - in try_to_wake_up() doing smp_cond_load_acquire().

To get a feeling for what on_cpu actually does; it doesn't have anything
much to do with SMP rebalancing code from interrupt contexts (although
that too still cares through can_migrate_task() <- task_running()).

> How about moving 'prepare_lock_switch' code from sched.h to prepare_task_switch
> in core.c?

With a rename; yes. Maybe something like 'acquire_task()' would do.

Then split the smp_store_release() out from finish_lock_switch() and
call it release_task(), and place is near the new acquire_task()
function -- don't forget to update all comments referring to
finish_lock_switch().

This then leaves the actual rq->lock fiddling in finish_lock_switch();
and that whole function too can be moved to core.c, somewhere near
finish_task_switch() I think.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ