[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20151221083812.GB11089@dhcp22.suse.cz>
Date: Mon, 21 Dec 2015 09:38:14 +0100
From: Michal Hocko <mhocko@...nel.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Mel Gorman <mgorman@...e.de>,
Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>,
David Rientjes <rientjes@...gle.com>,
Oleg Nesterov <oleg@...hat.com>,
Hugh Dickins <hughd@...gle.com>,
Andrea Argangeli <andrea@...nel.org>,
Rik van Riel <riel@...hat.com>,
linux-mm <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2] mm, oom: introduce oom reaper
On Fri 18-12-15 13:14:00, Andrew Morton wrote:
> On Fri, 18 Dec 2015 12:54:55 +0100 Michal Hocko <mhocko@...nel.org> wrote:
>
> > /* Retry the down_read_trylock(mmap_sem) a few times */
> > - while (attempts++ < 10 && !__oom_reap_vmas(mm))
> > - msleep_interruptible(100);
> > + while (attempts++ < 10 && !__oom_reap_vmas(mm)) {
> > + __set_task_state(current, TASK_IDLE);
> > + schedule_timeout(HZ/10);
> > + }
>
> If you won't, I shall ;)
>
>
> From: Andrew Morton <akpm@...ux-foundation.org>
> Subject: sched: add schedule_timeout_idle()
>
> This will be needed in the patch "mm, oom: introduce oom reaper".
>
> Cc: Michal Hocko <mhocko@...nel.org>
> Cc: Ingo Molnar <mingo@...e.hu>
> Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
> Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
Thanks! This makes more sense.
Acked-by: Michal Hocko <mhocko@...e.com>
> ---
>
> include/linux/sched.h | 1 +
> kernel/time/timer.c | 11 +++++++++++
> 2 files changed, 12 insertions(+)
>
> diff -puN kernel/time/timer.c~sched-add-schedule_timeout_idle kernel/time/timer.c
> --- a/kernel/time/timer.c~sched-add-schedule_timeout_idle
> +++ a/kernel/time/timer.c
> @@ -1566,6 +1566,17 @@ signed long __sched schedule_timeout_uni
> }
> EXPORT_SYMBOL(schedule_timeout_uninterruptible);
>
> +/*
> + * Like schedule_timeout_uninterruptible(), except this task will not contribute
> + * to load average.
> + */
> +signed long __sched schedule_timeout_idle(signed long timeout)
> +{
> + __set_current_state(TASK_IDLE);
> + return schedule_timeout(timeout);
> +}
> +EXPORT_SYMBOL(schedule_timeout_idle);
> +
> #ifdef CONFIG_HOTPLUG_CPU
> static void migrate_timer_list(struct tvec_base *new_base, struct hlist_head *head)
> {
> diff -puN include/linux/sched.h~sched-add-schedule_timeout_idle include/linux/sched.h
> --- a/include/linux/sched.h~sched-add-schedule_timeout_idle
> +++ a/include/linux/sched.h
> @@ -423,6 +423,7 @@ extern signed long schedule_timeout(sign
> extern signed long schedule_timeout_interruptible(signed long timeout);
> extern signed long schedule_timeout_killable(signed long timeout);
> extern signed long schedule_timeout_uninterruptible(signed long timeout);
> +extern signed long schedule_timeout_idle(signed long timeout);
> asmlinkage void schedule(void);
> extern void schedule_preempt_disabled(void);
>
> _
--
Michal Hocko
SUSE Labs
--
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