All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Dan Williams <dan.j.williams@intel.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: Arnd Bergmann <arnd@arndb.de>, Linux MM <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>
Subject: Re: [PATCH] mm/memory.c: Mark wp_huge_pmd() inline to prevent build failure
Date: Mon, 4 Dec 2017 08:54:44 +0100	[thread overview]
Message-ID: <CAMuHMdWdoZqaKe3J4tyedz2-2wyN7bwu8UR0ixLd=o=4YEX=Jg@mail.gmail.com> (raw)
In-Reply-To: <1512335500-10889-1-git-send-email-geert@linux-m68k.org>

On Sun, Dec 3, 2017 at 10:11 PM, Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
> With gcc 4.1.2:
>
>     mm/memory.o: In function `wp_huge_pmd':
>     memory.c:(.text+0x9b4): undefined reference to `do_huge_pmd_wp_page'
>
> Interestingly, wp_huge_pmd() is emitted in the assembler output, but
> never called.
>
> Apparently replacing the call to pmd_write() in __handle_mm_fault() by a
> call to the more complex pmd_access_permitted() reduced the ability of
> the compiler to remove unused code.

An alternative would be to start using #ifdefs and dummies for the
!CONFIG_TRANSPARENT_HUGEPAGE case, instead of relying on the varying degree
of ability of the various compiler versions to do dead code analysis and
elimination.

> Fix this by marking wp_huge_pmd() inline, like was done in commit
> 91a90140f9987101 ("mm/memory.c: mark create_huge_pmd() inline to prevent
> build failure") for a similar problem.
>
> Fixes: c7da82b894e9eef6 ("mm: replace pmd_write with pmd_access_permitted in fault + gup paths")
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---
>  mm/memory.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/memory.c b/mm/memory.c
> index 5eb3d2524bdc2823..f4d52847ca07a414 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -3831,7 +3831,7 @@ static inline int create_huge_pmd(struct vm_fault *vmf)
>         return VM_FAULT_FALLBACK;
>  }
>
> -static int wp_huge_pmd(struct vm_fault *vmf, pmd_t orig_pmd)
> +static inline int wp_huge_pmd(struct vm_fault *vmf, pmd_t orig_pmd)
>  {
>         if (vma_is_anonymous(vmf->vma))
>                 return do_huge_pmd_wp_page(vmf, orig_pmd);

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

WARNING: multiple messages have this Message-ID
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Dan Williams <dan.j.williams@intel.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: Arnd Bergmann <arnd@arndb.de>, Linux MM <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>
Subject: Re: [PATCH] mm/memory.c: Mark wp_huge_pmd() inline to prevent build failure
Date: Mon, 4 Dec 2017 08:54:44 +0100	[thread overview]
Message-ID: <CAMuHMdWdoZqaKe3J4tyedz2-2wyN7bwu8UR0ixLd=o=4YEX=Jg@mail.gmail.com> (raw)
In-Reply-To: <1512335500-10889-1-git-send-email-geert@linux-m68k.org>

On Sun, Dec 3, 2017 at 10:11 PM, Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
> With gcc 4.1.2:
>
>     mm/memory.o: In function `wp_huge_pmd':
>     memory.c:(.text+0x9b4): undefined reference to `do_huge_pmd_wp_page'
>
> Interestingly, wp_huge_pmd() is emitted in the assembler output, but
> never called.
>
> Apparently replacing the call to pmd_write() in __handle_mm_fault() by a
> call to the more complex pmd_access_permitted() reduced the ability of
> the compiler to remove unused code.

An alternative would be to start using #ifdefs and dummies for the
!CONFIG_TRANSPARENT_HUGEPAGE case, instead of relying on the varying degree
of ability of the various compiler versions to do dead code analysis and
elimination.

> Fix this by marking wp_huge_pmd() inline, like was done in commit
> 91a90140f9987101 ("mm/memory.c: mark create_huge_pmd() inline to prevent
> build failure") for a similar problem.
>
> Fixes: c7da82b894e9eef6 ("mm: replace pmd_write with pmd_access_permitted in fault + gup paths")
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---
>  mm/memory.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/memory.c b/mm/memory.c
> index 5eb3d2524bdc2823..f4d52847ca07a414 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -3831,7 +3831,7 @@ static inline int create_huge_pmd(struct vm_fault *vmf)
>         return VM_FAULT_FALLBACK;
>  }
>
> -static int wp_huge_pmd(struct vm_fault *vmf, pmd_t orig_pmd)
> +static inline int wp_huge_pmd(struct vm_fault *vmf, pmd_t orig_pmd)
>  {
>         if (vma_is_anonymous(vmf->vma))
>                 return do_huge_pmd_wp_page(vmf, orig_pmd);

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2017-12-04  7:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-03 21:11 Geert Uytterhoeven
2017-12-04  7:54 ` Geert Uytterhoeven [this message]
2017-12-04  7:54   ` Geert Uytterhoeven

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='CAMuHMdWdoZqaKe3J4tyedz2-2wyN7bwu8UR0ixLd=o=4YEX=Jg@mail.gmail.com' \
    --to=geert@linux-m68k.org \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=dan.j.williams@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --subject='Re: [PATCH] mm/memory.c: Mark wp_huge_pmd() inline to prevent build failure' \
    /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

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.