linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: Michal Hocko <mhocko@kernel.org>,
	akpm@linux-foundation.org, linux-mm@kvack.org
Subject: Re: [PATCH] mm,oom: Teach lockdep about oom_lock.
Date: Tue, 12 Mar 2019 09:24:25 +0100	[thread overview]
Message-ID: <20190312082425.GH32494@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <dd3c9f12-84e9-7cf8-1d24-02a9cfbcd509@i-love.sakura.ne.jp>

On Sat, Mar 09, 2019 at 03:02:22PM +0900, Tetsuo Handa wrote:
> @@ -1120,8 +1122,13 @@ void pagefault_out_of_memory(void)
>  	if (mem_cgroup_oom_synchronize(true))
>  		return;
>  
> -	if (!mutex_trylock(&oom_lock))
> +	if (!mutex_trylock(&oom_lock)) {
		/*
		 * Explain why we still need this on the fail back.
		 */
> +		oom_reclaim_acquire(GFP_KERNEL, 0);
> +		oom_reclaim_release(GFP_KERNEL, 0);
>  		return;
> +	}

	/*
	 * This changes the try-lock to a regular lock; because .....
	 * text goes here.
	 */

> +	oom_reclaim_release(GFP_KERNEL, 0);
> +	oom_reclaim_acquire(GFP_KERNEL, 0);
>  	out_of_memory(&oc);
>  	mutex_unlock(&oom_lock);
>  }
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 6d0fa5b..e8853a19 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -3793,6 +3793,8 @@ void warn_alloc(gfp_t gfp_mask, nodemask_t *nodemask, const char *fmt, ...)
>  		schedule_timeout_uninterruptible(1);
>  		return NULL;
>  	}

idem

> +	oom_reclaim_release(gfp_mask, order);
> +	oom_reclaim_acquire(gfp_mask, order);
>  
>  	/*
>  	 * Go through the zonelist yet one more time, keep very high watermark

these things might seem 'obvious' now, but I'm sure that the next time I
see this I'll go WTF?!


      parent reply	other threads:[~2019-03-12  8:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-08 10:22 Tetsuo Handa
2019-03-08 11:03 ` Michal Hocko
2019-03-08 11:29   ` Tetsuo Handa
2019-03-08 11:54     ` Michal Hocko
2019-03-08 11:58       ` Michal Hocko
2019-03-08 15:01         ` Peter Zijlstra
2019-03-08 15:13           ` Michal Hocko
2019-03-09  6:02             ` Tetsuo Handa
2019-03-11 10:30               ` Michal Hocko
2019-03-12 14:06                 ` Tetsuo Handa
2019-03-12 15:31                   ` Michal Hocko
2019-03-14 13:55                     ` Tetsuo Handa
2019-03-12  8:24               ` Peter Zijlstra [this message]

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=20190312082425.GH32494@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox