Re: [RFC] fs, proc: Introduce /proc/<pid>/task/<tid>/childrenentry v6
From: Oleg Nesterov
Date: Wed Jan 18 2012 - 09:42:51 EST
On 01/18, Cyrill Gorcunov wrote:
>
> So Oleg, I think you meant something like below? Comment is moved down an
> list_empty over siblings remans, right?
Yes, except the comment still looks misleading to me.
Otherwise looks correct, but I'll try to re-check once again with
the fresh head. Although I think you should remove me from CC: after
I found the nonexistent bug ;)
> +get_children_pid(struct proc_pid_children_iter *iter, struct pid *pid_prev, loff_t pos)
> +{
> ...
> + /*
> + * Slow search case
> + *
> + * We might miss some freshly created children
> + * here, but it was never promised to be
> + * accurate.
> + */
> + list_for_each_entry(task, &start->children, sibling) {
> + if (pos-- == 0) {
> + pid = get_pid(task_pid(task));
> + break;
> + }
> + }
This is minor, but "freshly created" looks very confusing to me.
What does it mean? We hold tasklist, we can't race with fork().
Yes we can miss a child, but this has nothing to do with "freshly".
Just suppose that the parent sleeps, but N children exit after we
printed their tids. Now the slow paths skips N extra children, we
miss N tasks.
Oleg.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/