From: Hugh Dickins <hughd@google.com>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Hugh Dickins <hughd@google.com>,
Matthew Wilcox <willy@infradead.org>,
Amit Pundir <amit.pundir@linaro.org>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
Dmitry Vyukov <dvyukov@google.com>,
Oleg Nesterov <oleg@redhat.com>,
Andrea Arcangeli <aarcange@redhat.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
John Stultz <john.stultz@linaro.org>,
linux-mm <linux-mm@kvack.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
youling257@gmail.com
Subject: Re: Linux 4.18-rc7
Date: Tue, 31 Jul 2018 17:09:48 -0700 (PDT) [thread overview]
Message-ID: <alpine.LSU.2.11.1807311611380.8601@eggly.anvils> (raw)
In-Reply-To: <20180731145718.pbyy3qkp2a2yvucs@kshutemo-mobl1>
On Tue, 31 Jul 2018, Kirill A. Shutemov wrote:
> On Tue, Jul 31, 2018 at 09:29:27AM +0300, Kirill A. Shutemov wrote:
> > On Mon, Jul 30, 2018 at 06:01:26PM -0700, Linus Torvalds wrote:
> > >
> > > So to me it looks like a historical check that simply doesn't
> > > "normally" trigger, but there's no reason I can see why we should care
> > > about the case it tests against.
> >
> > I'll think more on what could go wrong with __split_huge_pmd() called on
> > anon-THP page without mmap_sem(). It's not yet clear cut to me.
>
> I think not having mmap_sem taken at least on read when we call
> __split_huge_pmd() opens possiblity of race with khugepaged:
> khugepaged can collapse the page back to THP as soon as we drop ptl.
> As result pmd_none_or_trans_huge_or_clear_bad() would return true and we
> basically leave the THP behind, not zapped.
I think we don't care deeply about the POSIX truncate semantics on the
kind of "file" that has managed to get to this point: in the unlikely
event that a THP is immediately recreated there, never mind, so long as
we don't crash or leak memory or suchlike (the surplus THP would get
freed at exit).
I think we're altogether better off just deleting that VM_BUG_ON_VMA();
but I do find it very very hard to arrive at a firm conclusion on the
absolute safety of splitting a pmd without mmap_sem there (though any
problem unlikely even if real, and more likely a figment of my paranoia).
I believe the VM_BUG_ON is a relic from the old days, when anon_vma_lock
played a big part in guarding the pmd+page split: remember how mmap_sem
is one of the ways you can guarantee that the anon_vma will not vanish
beneath you (page_get_anon_vma was added later than anon THP).
I'm a little more worried by the nearby zap_huge_pmd() (which could
never be covered by a suitable VM_BUG_ON): the way that frees a
previously deposited page table, and you have no guarantee of when
and where that page table was last used. Again I can't point to an
actual problem, just the recollection that it's been found subtly
safe in the past, but any change in the conditions might affect that.
And a little worried to see how split_huge_page_to_list() uses
anon_vma_lock on PageAnon versus i_mmap_lock on !PageAnon: which
makes complete sense in itself, but won't protect against a PageAnon
THP being concurrently split from the truncate_pagecache() direction,
where unmap_mapping_range() uses i_mmap_lock. (simple_setattr() the
default setattr: that's a bit of a worry too.)
I feel I'm moaning and crying at shadows, rather than providing any
useful suggestions or patches; but thought I ought to report back.
Hugh
prev parent reply other threads:[~2018-08-01 0:09 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CA+55aFxpFefwVdTGVML99PSFUqwpJXPx5LVCA3D=g2t2_QLNsA@mail.gmail.com>
2018-07-30 6:47 ` Amit Pundir
2018-07-30 13:01 ` Kirill A. Shutemov
2018-07-30 13:34 ` Amit Pundir
2018-07-30 17:32 ` Linus Torvalds
2018-07-30 21:53 ` Hugh Dickins
2018-07-31 1:01 ` Linus Torvalds
2018-07-31 3:26 ` Hugh Dickins
2018-07-31 4:25 ` John Stultz
2018-07-31 6:40 ` Amit Pundir
2018-07-31 6:56 ` Kirill A. Shutemov
2018-07-31 16:29 ` Linus Torvalds
2018-07-31 16:56 ` John Stultz
2018-07-31 17:03 ` Kirill A. Shutemov
2018-07-31 17:43 ` Luck, Tony
2018-07-31 19:02 ` Linus Torvalds
2018-08-01 17:15 ` Linus Torvalds
2018-08-01 18:31 ` Hugh Dickins
2018-08-01 20:58 ` Kirill A. Shutemov
2018-08-01 21:55 ` Hugh Dickins
2018-08-02 19:12 ` John Stultz
2018-08-01 18:36 ` Luck, Tony
2018-08-01 20:05 ` Linus Torvalds
2018-08-01 20:51 ` Kirill A. Shutemov
2018-08-01 20:56 ` Linus Torvalds
2018-08-01 21:25 ` Kirill A. Shutemov
2018-08-02 6:59 ` Amit Pundir
2018-07-31 17:17 ` [PATCH] staging: ashmem: Fix SIGBUS crash when traversing mmaped ashmem pages John Stultz
2018-07-31 22:57 ` Linux 4.18-rc7 youling 257
2018-07-31 23:07 ` youling 257
2018-07-31 6:29 ` Kirill A. Shutemov
2018-07-31 14:57 ` Kirill A. Shutemov
2018-08-01 0:09 ` Hugh Dickins [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=alpine.LSU.2.11.1807311611380.8601@eggly.anvils \
--to=hughd@google.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=amit.pundir@linaro.org \
--cc=dvyukov@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=john.stultz@linaro.org \
--cc=kirill.shutemov@linux.intel.com \
--cc=kirill@shutemov.name \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=oleg@redhat.com \
--cc=torvalds@linux-foundation.org \
--cc=willy@infradead.org \
--cc=youling257@gmail.com \
/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