Re: [patch] "HT scheduler", sched-2.5.63-B3

David S. Miller (davem@redhat.com)
Thu, 06 Mar 2003 10:10:55 -0800 (PST)


From: Linus Torvalds <torvalds@transmeta.com>
Date: Thu, 6 Mar 2003 10:20:42 -0800 (PST)

Note that "in_interrupt()" will also trigger for callers that call from
bh-atomic regions as well as actual BH handlers. Which is correct - they
are both "interrupt contexts" as far as most users should be concerned.

The unix domain case may well be bh-atomic, I haven't looked at the code.
I'm pretty much certain that the TCP case _will_ be BH-atomic, even for
loopback.

David?

Unix sockets use non-BH locks, there are no software interrupts
involved in AF_UNIX processing so no need to protect against them.

The actual wakeup comes from the socket callbacks, we use the
default data_ready() which is:

void sock_def_readable(struct sock *sk, int len)
{
read_lock(&sk->callback_lock);
if (sk->sleep && waitqueue_active(sk->sleep))
wake_up_interruptible(sk->sleep);
sk_wake_async(sk,1,POLL_IN);
read_unlock(&sk->callback_lock);
}

And for write wakeups Unix uses it's own, which is:

static void unix_write_space(struct sock *sk)
{
read_lock(&sk->callback_lock);
if (unix_writable(sk)) {
if (sk->sleep && waitqueue_active(sk->sleep))
wake_up_interruptible(sk->sleep);
sk_wake_async(sk, 2, POLL_OUT);
}
read_unlock(&sk->callback_lock);
}

So, to reiterate, no BH locking is used by AF_UNIX.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/