mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Namhyung Kim <namhyung@kernel.org>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Rusty Russell <rusty@rustcorp.com.au>,
	"Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/2] kthread: kill task_get_live_kthread()
Date: Tue, 12 Mar 2013 19:18:35 +0100 (CET)	[thread overview]
Message-ID: <alpine.LFD.2.02.1303121914010.22263@ionos> (raw)
In-Reply-To: <20130312170424.GA12747@redhat.com>

On Tue, 12 Mar 2013, Oleg Nesterov wrote:

> Hi Thomas,
> 
> On 03/11, Thomas Gleixner wrote:
> >
> > On Mon, 11 Mar 2013, Oleg Nesterov wrote:
> > >
> > > But the actual reason for this cleanup is that I do not understand
> > > why park/unpark abuse kthread.c.
> >
> > It's not abusing it :)
> 
> Yes, yes, I didn't mean the code looks bad or something like this.
> 
> Just I thought that, perhaps, it would be more clean to hide this
> park/unpark logic in kernel/smpboot.c and do not add the "special"
> new members into "struct kthread".
> 
> But let me repeat, mostly I simply wanted to ask the question. I
> just noticed this new code and I was curious if this park/unpark
> logic should be applied to every kthread (in future) or it is only
> for smpboot_register_percpu_thread/etc.

It was written to avoid the continous teardown/setup of per cpu
threads in the notifiers. That was a) racy and b) a total waste of
time.
 
> > > Thomas, can't we move kthread->parked/cpu to smpboot_thread_data
> > > and move all this code into kernel/smpboot.c? Just for example,
> > > why kthread() does __kthread_parkme() ? smpboot_thread_fn() can do
> > > this at the start.
> >
> > No objection. When I implemented this, I thought this would be the
> > correct place and I followed the conventions of kthread.c ...
> 
> OK, I'll try to think again if this change is actually possible _and_
> it can really make the things more clean/simple.
> 
> > What's the issue with that, other than some superflous task_get/put
> > calls ?
> 
> Do you mean this particular cleanup?
> 
> No issues, this is only cleanup. But every cleanup is subjective, so
> please tell me if you disagree.

No objections as long as it gets cleaner and simpler and works :)
 
> Firstly, to_kthread() + barrier() + "vfork_done != NULL" doesn't look
> very clear (cough, yes, this was written by me). And after 1/2

:)
 
> 	static struct kthread *task_get_live_kthread(struct task_struct *k)
> 	{
> 		get_task_struct(k);
> 		return to_live_kthread(k);
> 	}
> 
> looks confusing too because it mixes 2 different things and because
> its usage is not clear. I mean, it is not clear why the caller needs
> get_task_struct() and why it is safe if we do not have a reference.

True. And in the case of the smpboot threads we actually take a ref on
the task struct in the create function.

Thanks,

	tglx



      reply	other threads:[~2013-03-12 18:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-11 17:36 Oleg Nesterov
2013-03-11 17:36 ` [PATCH 1/2] kthread: introduce to_live_kthread() Oleg Nesterov
2013-03-11 17:36 ` [PATCH 2/2] kthread: kill task_get_live_kthread() Oleg Nesterov
2013-03-11 21:15 ` [PATCH 0/2] " Thomas Gleixner
2013-03-12 17:04   ` Oleg Nesterov
2013-03-12 18:18     ` Thomas Gleixner [this message]

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=alpine.LFD.2.02.1303121914010.22263@ionos \
    --to=tglx@linutronix.de \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=oleg@redhat.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=rusty@rustcorp.com.au \
    --cc=srivatsa.bhat@linux.vnet.ibm.com \
    /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

Powered by JetHome