Re: SCO: "thread creation is about a thousand times faster than on

From: Alexander Viro (viro@math.psu.edu)
Date: Mon Aug 28 2000 - 09:33:45 EST


On Sun, 27 Aug 2000, Linus Torvalds wrote:

> Now THIS I agree with. Good notion - I like "unshare(CLONE_xxx)" as a
> system call. I just wouldn't overload it with "clone()" (ie I'd make it a
> new system call), because I'm just too attached to the fact that "clone()"
> applies the bitmask on the _new_ thread and leaves the old thread
> untouched. Changing the current thread is a fundamentally different
> things, I think. And is worth a special system call.

Umm... If we do that (separate syscall) we might very well want to invert
the bitmap. Because we will end up with unshare(~CLONE_FILES) and similar
as a typical use. Or, worse yet, get

unshare(CLONE_VM|CLONE_SIGHAND|CLONE_FS|CLONE_WHATEVER_THE_FSCK_WILL_BE_THERE)

where the last one may grow at any moment when we decide that we've
overlooked/acquired/invented another component. The latter form is an
invitation of breakage, the former... I'm not too happy about the idioms
that include negation.

IOW, while upon the task creation we usually do "copy all but..." here we
will rather need "copy this, this and that and leave the rest as is".
Comments?

BTW, I think that do_fork() should look like

#define CLONE_ACTION (CLONE_PTRACE|CLONE_VFORK|CLONE_PID|CSIGNAL)
int do_fork(flags, usp, regs)
{
        struct task_struct *p;
        int err;

        p = clone_task(current, flags & CLONE_ACTION, usp, regs);
        err = PTR_ERR(p);
        if (!IS_ERR(p))
                goto out;

        /* we want bitmap inverted and we don't want "action" bits */
        err = do_unshare(p, ~flags & ~CLONE_ACTION);
        if (err)
                goto out_release;

        /* insert into queues */
        ...
        return 0;

out_release:
        release_task(p); /* also used in do_exit() */
out:
        return err;
}

That would make the for better separation of the steps, IMO.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Aug 31 2000 - 21:00:21 EST