public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Scheduler: Removed first parameter from prepare_lock_switch
Date: Thu, 07 Dec 2017 21:52:25 +0000	[thread overview]
Message-ID: <20171207215225.v26vmzmnac3v6jfr@smtp.gmail.com> (raw)
In-Reply-To: <20171207083820.tpgeqcfoelnau637@hirez.programming.kicks-ass.net>

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

Got it! I am working on it.

  reply	other threads:[~2017-12-07 21:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-05 14:02 [PATCH] Scheduler: Removed first parameter from prepare_lock_switch rodrigosiqueira
2017-12-06 12:14 ` Peter Zijlstra
2017-12-06 23:50   ` Rodrigo Siqueira
2017-12-07  8:38     ` Peter Zijlstra
2017-12-07 21:52       ` Rodrigo Siqueira [this message]
2017-12-10 21:25         ` Rodrigo Siqueira

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171207215225.v26vmzmnac3v6jfr@smtp.gmail.com \
    --to=rodrigosiqueiramelo@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox