Re: [PATCH 1/2] kthread_create

Albert Cahalan
2003-12-31T20:20:24Z

> +struct task_struct *kthread_create(int (*initfn)(void *data),
> + int (*corefn)(void *data),
> + void *data,
> + const char namefmt[],
> + ...)
> +{
> + va_list args;
> + struct kthread_create kc;
> + DECLARE_WORK(work, spawn_kthread, &kc);
> + /* Or, as we like to say, 16. */
> + char name[sizeof(((struct task_struct *)0)->comm)];
> +
> + va_start(args, namefmt);
> + vsnprintf(name, sizeof(name), namefmt, args);
> + va_end(args);
> +
> + init_completion(&kc.done);
> + kc.k.initfn = initfn;
> + kc.k.corefn = corefn;
> + kc.k.data = data;
> + kc.k.name = name;

Since processor ID info is available, there's no
need for per-CPU naming. (I do realize it may be
per-disk or per-filesystem though)

With the huge NUMA boxes, a simple "ps -ef" is
going to look insane. How about task groups for
them? Then the various threads wind up being
seen as just that, threads.

BTW, some (p->pid==0) tests may need to become
(p->tgid==0) tests instead.