linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: wale zhang <wale.zhang.ftd@gmail.com>
To: Barry Song <21cnbao@gmail.com>
Cc: akpm@linux-foundation.org, chrisl@kernel.org, linux-mm@kvack.org,
	 lorenzo.stoakes@oracle.com
Subject: Re: [PATCH 1/1] mm,swapops: Fix compile error on set_pmd_migration_entry.
Date: Mon, 29 Dec 2025 19:37:34 +0800	[thread overview]
Message-ID: <CAHrEdeunY-YpDC7AoTFcppAvHCJpEJRp=GTQ4psRKRi_3fhB0Q@mail.gmail.com> (raw)
In-Reply-To: <20251228220742.11157-1-21cnbao@gmail.com>

On Mon, Dec 29, 2025 at 6:07 AM Barry Song <21cnbao@gmail.com> wrote:
>
> On Mon, Dec 29, 2025 at 10:37 AM Andrew Morton <akpm@linux-foundation.org> wrote:
> >
> > On Sat, 27 Dec 2025 17:58:40 +0800 wale zhang <wale.zhang.ftd@gmail.com> wrote:
> >
> > > > No. You still don’t understand my point. The BUILD_BUG means this
> > > > code will never have a chance to be compiled under any possible
> > > > kernel configuration. That makes it dead code. If there is any
> > > > kernel .config in which it can be built, then we should fix it.
> > > >
> > > > This set_pmd_migration_entry() has no chance of ever being built.
> > >
> > > Hello Barry,
> > >
> >
> > Please share the .config which was used to trigger this build error.
> >
> > (It is strange to have this should-never-be-compiled code.  Why not just
> > delete it and let the compiler/linker report the error.)
>
> Right. We should entirely drop it in mainline. If Wale does want an
> O0 build, then the only call to set_pmd_migration_entry() that is not
> under
>
> #ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION
>
> is migrate_vma_collect_huge_pmd() in mm/migrate_device.c.
>
> Then what we really need is as follows:
>
> diff --git a/include/linux/swapops.h b/include/linux/swapops.h
> index 8cfc966eae48..fdd4375d5d90 100644
> --- a/include/linux/swapops.h
> +++ b/include/linux/swapops.h
> @@ -339,17 +339,6 @@ static inline pmd_t swp_entry_to_pmd(swp_entry_t entry)
>  }
>
>  #else  /* CONFIG_ARCH_ENABLE_THP_MIGRATION */
> -static inline int set_pmd_migration_entry(struct page_vma_mapped_walk *pvmw,
> -               struct page *page)
> -{
> -       BUILD_BUG();
> -}
> -
> -static inline void remove_migration_pmd(struct page_vma_mapped_walk *pvmw,
> -               struct page *new)
> -{
> -       BUILD_BUG();
> -}
>
>  static inline void pmd_migration_entry_wait(struct mm_struct *m, pmd_t *p) { }
>
> diff --git a/mm/migrate_device.c b/mm/migrate_device.c
> index 23379663b1e1..74d23c91626a 100644
> --- a/mm/migrate_device.c
> +++ b/mm/migrate_device.c
> @@ -195,8 +195,9 @@ static int migrate_vma_collect_huge_pmd(pmd_t *pmdp, unsigned long start,
>                 return migrate_vma_collect_skip(start, end, walk);
>         }
>
> -       if (thp_migration_supported() &&
> -               (migrate->flags & MIGRATE_VMA_SELECT_COMPOUND) &&
> +
> +#ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION
> +       if ((migrate->flags & MIGRATE_VMA_SELECT_COMPOUND) &&
>                 (IS_ALIGNED(start, HPAGE_PMD_SIZE) &&
>                  IS_ALIGNED(end, HPAGE_PMD_SIZE))) {
>
> @@ -226,6 +227,7 @@ static int migrate_vma_collect_huge_pmd(pmd_t *pmdp, unsigned long start,
>                 spin_unlock(ptl);
>                 return 0;
>         }
> +#endif
>
>  fallback:
>         spin_unlock(ptl);
>
> Thanks
> Barry
>

OK. I will prepare the next patch to delete this unnecessary codes.
Thank you for your guidance.

--
Thanks
Wale


  reply	other threads:[~2025-12-29 11:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-25  9:40 Wale Zhang
2025-12-25 10:22 ` Barry Song
2025-12-26 11:45   ` wale zhang
2025-12-26 18:43     ` Barry Song
2025-12-27  7:51       ` wale zhang
2025-12-27  8:16         ` Barry Song
2025-12-27  9:58           ` wale zhang
2025-12-27 11:25             ` Barry Song
2025-12-28 21:37             ` Andrew Morton
2025-12-28 22:07               ` Barry Song
2025-12-29 11:37                 ` wale zhang [this message]
2025-12-30  5:00     ` Matthew Wilcox
2025-12-30  8:05       ` wale zhang

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='CAHrEdeunY-YpDC7AoTFcppAvHCJpEJRp=GTQ4psRKRi_3fhB0Q@mail.gmail.com' \
    --to=wale.zhang.ftd@gmail.com \
    --cc=21cnbao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=chrisl@kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.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