linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@infradead.org>
To: Hugh Dickins <hughd@google.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: 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>
Subject: Re: linux-next: Tree for Apr 14 (mm/shmem.c)
Date: Wed, 15 Apr 2020 08:34:27 -0700	[thread overview]
Message-ID: <c1ea321f-b0f3-5ec3-3af8-8bf545a6462c@infradead.org> (raw)
In-Reply-To: <alpine.LSU.2.11.2004142339170.10035@eggly.anvils>

On 4/14/20 11:54 PM, Hugh Dickins wrote:
> 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>

Works for me, using gcc 7.5.0.

Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested

Thanks.

> ---
> 
>  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);
> 


-- 
~Randy


      reply	other threads:[~2020-04-15 15:34 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 ` Randy Dunlap
2020-04-15  1:24   ` Andrew Morton
2020-04-15  6:54     ` Hugh Dickins
2020-04-15 15:34       ` Randy Dunlap [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=c1ea321f-b0f3-5ec3-3af8-8bf545a6462c@infradead.org \
    --to=rdunlap@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-next@vger.kernel.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