[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACBanvoArjZ=7rjXjt5fN6MrhLohPY7NAjQwhWepnMLZbqpHdQ@mail.gmail.com>
Date: Wed, 20 Feb 2013 10:09:14 -0800
From: Mandeep Singh Baines <msb@...omium.org>
To: Oleg Nesterov <oleg@...hat.com>
Cc: linux-kernel@...r.kernel.org, Tejun Heo <tj@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
"Rafael J. Wysocki" <rjw@...k.pl>, Ingo Molnar <mingo@...hat.com>,
adurbin@...omium.org
Subject: Re: [PATCH 4/5] freezer: clear fake signal on exit from __refrigerator
On Sat, Feb 16, 2013 at 9:12 AM, Oleg Nesterov <oleg@...hat.com> wrote:
> Forgot to mention...
>
> On 02/16, Oleg Nesterov wrote:
>> On 02/16, Mandeep Singh Baines wrote:
>> >
>> > --- a/kernel/freezer.c
>> > +++ b/kernel/freezer.c
>> > @@ -81,6 +81,9 @@ bool __refrigerator(bool check_kthr_stop)
>> > */
>> > set_current_state(save);
>> >
>> > + /* Clear fake signal from freeze_task(). */
>> > + recalc_sigpending();
>>
>> NACK. We can't do this lockless.
>>
>> And I am not sure we should reinstantiate it here.
>
> And note that with the fix I propose in reply to 5/5 this change is
> not needed.
>
I think we need something like this in order to be able to fix
wait_event_freezable and friends. Here is one idea:
#define __wait_event_freezable(wq, condition, ret) \
do { \
DEFINE_WAIT(__wait); \
\
for (;;) { \
prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \
if (condition) \
break; \
if (!signal_pending(current)) { \
freezable_schedule();
\
continue; \
} \
ret = -ERESTARTSYS; \
break; \
} \
finish_wait(&wq, &__wait); \
} while (0)
#define wait_event_freezable(wq, condition) \
({ \
int __ret = 0; \
if (!(condition)) \
__wait_event_freezable(wq, condition, __ret); \
__ret; \
})
If you cleaned up the fake signal in __refrigerator() then this
implementation of wait_event_freezable should address all the fake
signal bugs.
By the time you get to signal_pending() the fake signal is cleared and
the bug it avoided.
Regards,
Mandeep
> Oleg.
>
--
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