[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <492CD567.6060507@gmail.com>
Date: Wed, 26 Nov 2008 13:49:43 +0900
From: Tejun Heo <htejun@...il.com>
To: Oleg Nesterov <oleg@...hat.com>
CC: Eric Van Hensbergen <ericvh@...il.com>,
Ron Minnich <rminnich@...dia.gov>, Ingo Molnar <mingo@...e.hu>,
Christoph Hellwig <hch@...radead.org>,
Miklos Szeredi <mszeredi@...e.cz>,
Davide Libenzi <davidel@...ilserver.org>,
Brad Boyer <flar@...andria.com>,
Al Viro <viro@...iv.linux.org.uk>,
Roland McGrath <roland@...hat.com>,
Mauro Carvalho Chehab <mchehab@...radead.org>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org
Subject: Re: + poll-allow-f_op-poll-to-sleep-take-4.patch added to -mm tree
Tejun Heo wrote:
>> And don't we (in theory) actually need the mb() here instead?
>>
>> Let's suppose do_poll() starts the next iteration, so we are doing
>>
>> pwq->triggered = 0;
>>
>> ->poll(file)
>> if (!check_file(file))
>> return 0;
>>
>> return POLLXXX;
>>
>> We don't have any barriers in between (unless fget_light bumps
>> ->f_count), so this can be reordered as
>>
>> ->poll(file)
>> if (!check_file(file))
>> return 0;
>>
>> pwq->triggered = 0;
>>
>> And, if pollwake() happens in between we can miss the event, no?
>
> Hmmmm... yes, from the second run, ->poll doesn't grab the waitqueue
> lock, so it doesn't necessary have the required barriers.
> Heh... set_mb() should be here not in pollwake(). Thanks for spotting
> it.
Oh, I remembered why I didn't use set_mb() there. The logic was that
once the wait is over by either event triggering or timeout, the
poll/select finishes by either valid event or the timeout, but that
isn't true as the wake up could be spurious due to implementation
details or event masking, so yes we do need barrier there.
Thanks.
--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists