Re: [PATCH -mm 4/5][AIO] - AIO completion signal notification

From: Sébastien Dugué
Date: Wed Nov 29 2006 - 09:18:37 EST


On Wed, 29 Nov 2006 13:50:12 +0000, Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote:

> On Wed, Nov 29, 2006 at 02:08:01PM +0100, S?bastien Dugu? wrote:
> > On Wed, 29 Nov 2006 10:51:50 +0000, Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote:
> >
> > > I'm a little bit unhappy about the usage of the notify flag. The usage
> > > seems correct but very confusing:
> >
> > Well, I followed the logic from posix-timers.c, but it may be a poor
> > choice ;-)
> >
> > For a start, the SIGEV_* flags are quite confusing (for me at least).
> > SIGEV_SIGNAL is defined as 0, SIGEV_NONE as 1 and SIGEV_THREAD_ID as 4. I
> > would rather have seen SIGEV_NONE defined as 0 to avoid all this.
> >
> > I also wish I knew why those SIGEV_* constants were defined that way.
>
> Ah, I missed that. It explains some of the more wierd bits. I suspect
> we should then use != SIGEV_NONE for the any kind of signal notification
> bit and == SIGEV_THREAD_ID for the case where we want to deliver to
> a particular thread.

Right, that would make things much cleaner. Will try for it.

>
> But this means we only get a thread reference for SIGEV_THREAD_ID
> here:
>
> > > > + if (notify->notify == (SIGEV_SIGNAL|SIGEV_THREAD_ID)) {
> > > > + /*
> > > > + * This reference will be dropped in really_put_req() when
> > > > + * we're done with the request.
> > > > + */
> > > > + get_task_struct(target);
> > > > + }

It's the way it is in posix-timers and I'm not sure I understand why. We take
a ref on the specific task if notify is SIGEV_THREAD_ID but not for
SIGEV_SIGNAL.

I'm wondering what I'm missing here, shouldn't we also take a ref on the task
group leader in the SIGEV_SIGNAL case in posix-timers?

>
> But even use it for SIGEV_SIGNAL without SIGEV_THREAD_ID here:
>
> > > > + if (notify->notify & SIGEV_THREAD_ID)
> > > > + ret = send_sigqueue(notify->signo, sigq, notify->target);
> > > > + else
> > > > + ret = send_group_sigqueue(notify->signo, sigq, notify->target);
>
> Or do I miss something?

I missing something too here ;-)

If someone cared to explain why there is no ref taken on the task for the
SIGEV_SIGNAL case, it would be much appreciated. Is this a bug in posix-timers?


Thanks,

Sébastien.
-
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/