From: Peter Zijlstra <peterz@infradead.org>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>,
Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
David Rientjes <rientjes@google.com>, Ingo Molnar <mingo@elte.hu>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH 1/9] sched: add schedule_timeout_idle()
Date: Tue, 22 Mar 2016 22:23:52 +0100 [thread overview]
Message-ID: <20160322212352.GF6356@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20160322175626.GA13302@cmpxchg.org>
On Tue, Mar 22, 2016 at 01:56:26PM -0400, Johannes Weiner wrote:
> On Tue, Mar 22, 2016 at 02:22:49PM +0100, Peter Zijlstra wrote:
> > On Tue, Mar 22, 2016 at 02:08:23PM +0100, Michal Hocko wrote:
> > > On Tue 22-03-16 13:51:13, Peter Zijlstra wrote:
> > > If that sounds like a more appropriate plan I won't object. I can simply
> > > change my patch to do __set_current_state and schedule_timeout.
> >
> > I dunno, I just think these wrappers are silly.
>
> Adding out-of-line, exported wrappers for every single task state is
> kind of silly. But it's still a common operation to wait in a certain
> state, so having a single function for that makes sense. Kind of like
> spin_lock_irqsave and friends.
>
> Maybe this would be better?:
>
> static inline long schedule_timeout_state(long timeout, long state)
> {
> __set_current_state(state);
> return schedule_timeout(timeout);
> }
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 ?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Peter Zijlstra <peterz@infradead.org>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>,
Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
David Rientjes <rientjes@google.com>, Ingo Molnar <mingo@elte.hu>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH 1/9] sched: add schedule_timeout_idle()
Date: Tue, 22 Mar 2016 22:23:52 +0100 [thread overview]
Message-ID: <20160322212352.GF6356@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20160322175626.GA13302@cmpxchg.org>
On Tue, Mar 22, 2016 at 01:56:26PM -0400, Johannes Weiner wrote:
> On Tue, Mar 22, 2016 at 02:22:49PM +0100, Peter Zijlstra wrote:
> > On Tue, Mar 22, 2016 at 02:08:23PM +0100, Michal Hocko wrote:
> > > On Tue 22-03-16 13:51:13, Peter Zijlstra wrote:
> > > If that sounds like a more appropriate plan I won't object. I can simply
> > > change my patch to do __set_current_state and schedule_timeout.
> >
> > I dunno, I just think these wrappers are silly.
>
> Adding out-of-line, exported wrappers for every single task state is
> kind of silly. But it's still a common operation to wait in a certain
> state, so having a single function for that makes sense. Kind of like
> spin_lock_irqsave and friends.
>
> Maybe this would be better?:
>
> static inline long schedule_timeout_state(long timeout, long state)
> {
> __set_current_state(state);
> return schedule_timeout(timeout);
> }
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 ?
next prev parent reply other threads:[~2016-03-22 21:24 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-22 11:00 [PATCH 0/9] oom reaper v6 Michal Hocko
2016-03-22 11:00 ` Michal Hocko
2016-03-22 11:00 ` [PATCH 1/9] sched: add schedule_timeout_idle() Michal Hocko
2016-03-22 11:00 ` Michal Hocko
2016-03-22 12:23 ` Peter Zijlstra
2016-03-22 12:23 ` Peter Zijlstra
2016-03-22 12:33 ` Michal Hocko
2016-03-22 12:33 ` Michal Hocko
2016-03-22 12:51 ` Peter Zijlstra
2016-03-22 12:51 ` Peter Zijlstra
2016-03-22 13:08 ` Michal Hocko
2016-03-22 13:08 ` Michal Hocko
2016-03-22 13:22 ` Peter Zijlstra
2016-03-22 13:22 ` Peter Zijlstra
2016-03-22 17:56 ` Johannes Weiner
2016-03-22 17:56 ` Johannes Weiner
2016-03-22 21:23 ` Peter Zijlstra [this message]
2016-03-22 21:23 ` Peter Zijlstra
2016-03-23 10:43 ` Michal Hocko
2016-03-23 10:43 ` Michal Hocko
2016-03-22 23:02 ` Andrew Morton
2016-03-22 23:02 ` Andrew Morton
2016-03-22 11:00 ` [PATCH 2/9] mm, oom: introduce oom reaper Michal Hocko
2016-03-22 11:00 ` Michal Hocko
2016-03-22 22:45 ` Andrew Morton
2016-03-22 22:45 ` Andrew Morton
2016-03-22 22:58 ` Hugh Dickins
2016-03-22 22:58 ` Hugh Dickins
2016-03-22 11:00 ` [PATCH 3/9] oom: clear TIF_MEMDIE after oom_reaper managed to unmap the address space Michal Hocko
2016-03-22 11:00 ` Michal Hocko
2016-03-22 11:00 ` [PATCH 4/9] mm, oom_reaper: report success/failure Michal Hocko
2016-03-22 11:00 ` Michal Hocko
2016-03-22 11:00 ` [PATCH 5/9] mm, oom_reaper: implement OOM victims queuing Michal Hocko
2016-03-22 11:00 ` Michal Hocko
2016-03-22 11:00 ` [PATCH 6/9] oom, oom_reaper: disable oom_reaper for oom_kill_allocating_task Michal Hocko
2016-03-22 11:00 ` Michal Hocko
2016-03-22 11:00 ` [PATCH 7/9] oom: make oom_reaper_list single linked Michal Hocko
2016-03-22 11:00 ` Michal Hocko
2016-03-22 11:00 ` [PATCH 8/9] oom: make oom_reaper freezable Michal Hocko
2016-03-22 11:00 ` Michal Hocko
2016-03-22 11:00 ` [PATCH 9/9] oom, oom_reaper: protect oom_reaper_list using simpler way Michal Hocko
2016-03-22 11:00 ` Michal Hocko
2016-03-22 22:08 ` [PATCH 0/9] oom reaper v6 David Rientjes
2016-03-22 22:08 ` David Rientjes
2016-03-23 11:11 ` Tetsuo Handa
2016-03-23 11:11 ` Tetsuo Handa
2016-03-23 12:07 ` Michal Hocko
2016-03-23 12:07 ` Michal Hocko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160322212352.GF6356@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=mingo@elte.hu \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=rientjes@google.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.