All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: linux-mm@kvack.org, Roman Gushchin <guro@fb.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [RFC PATCH 0/3] rework mmap-exit vs. oom_reaper handover
Date: Wed, 12 Sep 2018 15:42:03 +0200	[thread overview]
Message-ID: <20180912134203.GJ10951@dhcp22.suse.cz> (raw)
In-Reply-To: <20180912075054.GZ10951@dhcp22.suse.cz>

On Wed 12-09-18 09:50:54, Michal Hocko wrote:
> On Tue 11-09-18 23:01:57, Tetsuo Handa wrote:
> > On 2018/09/10 21:55, Michal Hocko wrote:
> > > This is a very coarse implementation of the idea I've had before.
> > > Please note that I haven't tested it yet. It is mostly to show the
> > > direction I would wish to go for.
> > 
> > Hmm, this patchset does not allow me to boot. ;-)
> > 
> >         free_pgd_range(&tlb, vma->vm_start, vma->vm_prev->vm_end,
> >                         FIRST_USER_ADDRESS, USER_PGTABLES_CEILING);
> > 
> > [    1.875675] sched_clock: Marking stable (1810466565, 65169393)->(1977240380, -101604422)
> > [    1.877833] registered taskstats version 1
> > [    1.877853] Loading compiled-in X.509 certificates
> > [    1.878835] zswap: loaded using pool lzo/zbud
> > [    1.880835] BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
> 
> This is vm_prev == NULL. I thought we always have vm_prev as long as
> this is not a single VMA in the address space. I will double check this.

So this is me misunderstanding the code. vm_next, vm_prev are not a full
doubly linked list. The first entry doesn't really refer to the last
entry. So the above cannot work at all. We can go around this in two
ways. Either keep the iteration or use the following which should cover
the full mapped range, unless I am missing something

diff --git a/mm/mmap.c b/mm/mmap.c
index 64e8ccce5282..078295344a17 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -3105,7 +3105,7 @@ void exit_mmap(struct mm_struct *mm)
 		up_write(&mm->mmap_sem);
 	}
 
-	free_pgd_range(&tlb, vma->vm_start, vma->vm_prev->vm_end,
+	free_pgd_range(&tlb, vma->vm_start, mm->highest_vm_end,
 			FIRST_USER_ADDRESS, USER_PGTABLES_CEILING);
 	tlb_finish_mmu(&tlb, 0, -1);
 
-- 
Michal Hocko
SUSE Labs

  reply	other threads:[~2018-09-12 13:42 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-08  4:54 [PATCH v2] mm, oom: Fix unnecessary killing of additional processes Tetsuo Handa
2018-09-10  9:54 ` Michal Hocko
2018-09-10 11:27   ` Tetsuo Handa
2018-09-10 11:40     ` Michal Hocko
2018-09-10 12:52       ` Tetsuo Handa
2018-09-10 12:55 ` [RFC PATCH 0/3] rework mmap-exit vs. oom_reaper handover Michal Hocko
2018-09-10 12:55   ` [RFC PATCH 1/3] mm, oom: rework mmap_exit vs. oom_reaper synchronization Michal Hocko
2018-09-10 12:55   ` [RFC PATCH 2/3] mm, oom: keep retrying the oom_reap operation as long as there is substantial memory left Michal Hocko
2018-09-10 12:55   ` [RFC PATCH 3/3] mm, oom: hand over MMF_OOM_SKIP to exit path if it is guranteed to finish Michal Hocko
2018-09-10 14:59   ` [RFC PATCH 0/3] rework mmap-exit vs. oom_reaper handover Tetsuo Handa
2018-09-10 15:11     ` Michal Hocko
2018-09-10 15:40       ` Tetsuo Handa
2018-09-10 16:44         ` Michal Hocko
2018-09-12  3:06           ` Tetsuo Handa
2018-09-12  7:18             ` Michal Hocko
2018-09-12  7:58               ` Tetsuo Handa
2018-09-12  8:17                 ` Michal Hocko
2018-09-12 10:59                   ` Tetsuo Handa
2018-09-12 11:22                     ` Michal Hocko
2018-09-11 14:01   ` Tetsuo Handa
2018-09-12  7:50     ` Michal Hocko
2018-09-12 13:42       ` Michal Hocko [this message]
2018-09-13  2:44         ` Tetsuo Handa
2018-09-13  9:09           ` Michal Hocko
2018-09-13 11:20             ` Tetsuo Handa
2018-09-13 11:35               ` Michal Hocko
2018-09-13 11:53                 ` Tetsuo Handa
2018-09-13 13:40                   ` Michal Hocko
2018-09-14 13:54                     ` Tetsuo Handa
2018-09-14 14:14                       ` Michal Hocko
2018-09-14 17:07                         ` Tetsuo Handa

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=20180912134203.GJ10951@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=guro@fb.com \
    --cc=linux-mm@kvack.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 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.