linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Hugh Dickins <hughd@google.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Randy Dunlap <rdunlap@infradead.org>,
	 Stephen Rothwell <sfr@canb.auug.org.au>,
	 Linux Next Mailing List <linux-next@vger.kernel.org>,
	 Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	 Linux MM <linux-mm@kvack.org>, Hugh Dickins <hughd@google.com>
Subject: Re: linux-next: Tree for Apr 14 (mm/shmem.c)
Date: Tue, 14 Apr 2020 23:54:29 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LSU.2.11.2004142339170.10035@eggly.anvils> (raw)
In-Reply-To: <20200414182430.c5af29ddb1735f5fd0083983@linux-foundation.org>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2742 bytes --]

On Tue, 14 Apr 2020, Andrew Morton wrote:
> On Tue, 14 Apr 2020 07:18:01 -0700 Randy Dunlap <rdunlap@infradead.org> wrote:
> > On 4/13/20 7:39 PM, Stephen Rothwell wrote:
> > > Hi all,
> > > 
> > > Changes since 20200413:
> > > 
> > > New tree: mhi
> > > 
> > > My fixes tree contains:
> > > 
> > >   6b038bdcd3d1 sh: mm: Fix build error
> > > 
> > > Non-merge commits (relative to Linus' tree): 1154
> > >  1160 files changed, 31764 insertions(+), 13498 deletions(-)
> > > 
> > > ----------------------------------------------------------------------------
> > 
> > on x86_64:
> > # CONFIG_TRANSPARENT_HUGEPAGE is not set
> 
> Thanks.  hm, this took a long time to be discovered.
> 
> > In file included from ../include/linux/export.h:43:0,
> >                  from ../include/linux/linkage.h:7,
> >                  from ../include/linux/fs.h:5,
> >                  from ../mm/shmem.c:24:
> > ../mm/shmem.c: In function ‘shmem_undo_range’:
...
> > ../mm/shmem.c:961:26: note: in expansion of macro ‘HPAGE_PMD_NR’
> >           round_up(start, HPAGE_PMD_NR))
> >                           ^~~~~~~~~~~~
> 
> That's
> 					if (index <
> 					    round_up(start, HPAGE_PMD_NR))
> 						start = index + 1;
> 
> from Hugh's 71725ed10c40696 ("mm: huge tmpfs: try to split_huge_page()
> when punching hole").

Sorry about that.  Yes, odd that it should only hit now: the false
PageTransCompound in shmem_punch_compound() has always been good
enough to handle it for me, but maybe Randy is trying a less able
compiler, or maybe unrelated changes in linux-next have just made
it harder for the compiler to see the optimization.

I hope the patch below fixes it?

[PATCH] mm/shmem: fix build without THP

Some optimizers don't notice that shmem_punch_compound() is always true
(PageTransCompound() being false) without CONFIG_TRANSPARENT_HUGEPAGE=y:
use IS_ENABLED to help them to avoid the BUILD_BUG inside HPAGE_PMD_NR.

Fixes: 71725ed10c40 ("mm: huge tmpfs: try to split_huge_page() when punching hole")
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Hugh Dickins <hughd@google.com>
---

 mm/shmem.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- 5.7-rc1/mm/shmem.c	2020-04-11 12:58:26.415524805 -0700
+++ linux/mm/shmem.c	2020-04-14 23:20:25.517656174 -0700
@@ -952,7 +952,7 @@ static void shmem_undo_range(struct inod
 				VM_BUG_ON_PAGE(PageWriteback(page), page);
 				if (shmem_punch_compound(page, start, end))
 					truncate_inode_page(mapping, page);
-				else {
+				else if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) {
 					/* Wipe the page and don't get stuck */
 					clear_highpage(page);
 					flush_dcache_page(page);

  reply	other threads:[~2020-04-15  6:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200414123900.4f97a83f@canb.auug.org.au>
2020-04-14 14:18 ` linux-next: Tree for Apr 14 (mm/shmem.c) Randy Dunlap
2020-04-15  1:24   ` Andrew Morton
2020-04-15  6:54     ` Hugh Dickins [this message]
2020-04-15 15:34       ` Randy Dunlap

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.2004142339170.10035@eggly.anvils \
    --to=hughd@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-next@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=sfr@canb.auug.org.au \
    /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;
as well as URLs for NNTP newsgroup(s).