[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160323104344.GC7059@dhcp22.suse.cz>
Date: Wed, 23 Mar 2016 11:43:44 +0100
From: Michal Hocko <mhocko@...nel.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Johannes Weiner <hannes@...xchg.org>,
Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
LKML <linux-kernel@...r.kernel.org>,
Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>,
David Rientjes <rientjes@...gle.com>,
Ingo Molnar <mingo@...e.hu>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH 1/9] sched: add schedule_timeout_idle()
On Tue 22-03-16 22:23:52, Peter Zijlstra wrote:
[...]
> Probably. However, with such semantics the schedule*() name is wrong
> too, you cannot use these functions to build actual wait loops etc.
>
> So maybe:
>
> static inline long sleep_in_state(long timeout, long state)
> {
> __set_current_state(state);
> return schedule_timeout(timeout);
> }
>
> might be an even better name; but at that point we look very like the
> msleep*() class of function, so maybe we should do:
>
> long sleep_in_state(long state, long timeout)
> {
> while (timeout && !signal_pending_state(state, current)) {
> __set_current_state(state);
> timeout = schedule_timeout(timeout);
> }
> return timeout;
> }
>
> Hmm ?
I am not sure how many callers do care about premature wake-ups (e.g
I could find a use for it) but this indeed has a better and cleaner
semantic.
--
Michal Hocko
SUSE Labs
Powered by blists - more mailing lists