Re: [RFC,PATCH] use rcu for fasync_lock

From: OGAWA Hirofumi
Date: Sun Dec 21 2003 - 13:42:02 EST


Manfred Spraul <manfred@xxxxxxxxxxxxxxxx> writes:

> void kill_fasync(struct fasync_struct **fp, int sig, int band)
> {
> - read_lock(&fasync_lock);
> + rcu_read_lock();
> __kill_fasync(*fp, sig, band);
> - read_unlock(&fasync_lock);
> + rcu_read_unlock();
> }

Usually *fp is NULL, I think. So what about the following test?

void kill_fasync(struct fasync_struct **fp, int sig, int band)
{
if (*fp) {
rcu_read_lock();
__kill_fasync(*fp, sig, band);
rcu_read_unlock();
}
}

Or use inline function for testing *fp.
--
OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx>
-
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/