From: Pavel Emelyanov <xemul-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
To: Oleg Nesterov <oleg-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
Cc: Linux Containers <containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org>
Subject: Re: [RFC][PATCH] Cleanup the new thread's creation
Date: Mon, 27 Aug 2007 10:43:24 +0400 [thread overview]
Message-ID: <46D2728C.6080907@openvz.org> (raw)
In-Reply-To: <20070825165031.GA2644-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
Oleg Nesterov wrote:
> On 08/24, Pavel Emelyanov wrote:
>> The major differences of creating a new thread from creating a
>> new process is that
>>
>> 1. newbie's tgid is set to leader's
>> 2. newbie's leader is set to leader
>> 3. newbie is added to leader's thread_list
>
> (Surely, the are many other major differences, but from the pids virtualization
> POV - yes ;)
>
>> +static void setup_new_thread(struct task_struct *thr, struct task_struct
>> *leader)
>> +{
>> + thr->tgid = leader->tgid;
>> + thr->group_leader = leader;
>> + list_add_tail_rcu(&thr->thread_group, &leader->thread_group);
>> +}
>
> Imho, this name is a bit "too generic". Not that I can suggest something
> better... copy_sub_thread/copy_group_leader ?
>
>> @@ -1147,9 +1161,6 @@ static struct task_struct *copy_process(
>> }
>>
>> p->pid = pid_nr(pid);
>> - p->tgid = p->pid;
>> - if (clone_flags & CLONE_THREAD)
>> - p->tgid = current->tgid;
>
> I agree, it is absoulutely not clear why should we set ->tgid here, and it
> would be nice to consolidate "if (CLONE_THREAD)" checks, but do we really
> need the helpers above? There are very simple, and have the only one caller.
> Sometimes it is good to see what's going on without pressing C-]
>
> Not that I against this patch, just I'm not sure it really simplifies things.
> Perhaps I missed something else you have in mind.
Me too, but while cleaning up the pid_t usage over the kernel I found
this place to be one of the most difficult from "how to make it better"
point of view. We need to hide the pid/tgid explicit usage somehow, but
the problem is that pid and tgid are set in this place and de_thread()
only and making helpers like set_task_tgid() doesn't sound reasonable.
> Oleg.
>
>
Thanks,
Pavel
prev parent reply other threads:[~2007-08-27 6:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-24 12:46 [RFC][PATCH] Cleanup the new thread's creation Pavel Emelyanov
[not found] ` <46CED326.3030606-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-08-25 16:50 ` Oleg Nesterov
[not found] ` <20070825165031.GA2644-6lXkIZvqkOAvJsYlp49lxw@public.gmane.org>
2007-08-27 6:43 ` Pavel Emelyanov [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=46D2728C.6080907@openvz.org \
--to=xemul-gefaqzzx7r8dnm+yrofe0a@public.gmane.org \
--cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
--cc=oleg-6lXkIZvqkOAvJsYlp49lxw@public.gmane.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