From: John Hubbard <jhubbard@nvidia.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: kernel test robot <lkp@intel.com>, Jakub Acs <acsjakub@amazon.de>,
llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
Linux Memory Management List <linux-mm@kvack.org>,
rust-for-linux@vger.kernel.org
Subject: Re: [linux-next:master 13069/13300] error[E0425]: cannot find value `VM_MERGEABLE` in crate `bindings`
Date: Thu, 2 Oct 2025 14:51:33 -0700 [thread overview]
Message-ID: <5467d9cc-54c3-415c-9ddd-a1ff1026f29e@nvidia.com> (raw)
In-Reply-To: <CANiq72kOhRdGtQe2UVYmDLdbw6VNkiMtdFzkQizsfQV0gLY1Hg@mail.gmail.com>
On 10/2/25 2:42 PM, Miguel Ojeda wrote:
> On Thu, Oct 2, 2025 at 11:19 PM Andrew Morton <akpm@linux-foundation.org> wrote:
>>
>> No idea. Let me cc rust-for-linux.
>>
>> It's a one-line patch:
>>
>> --- a/include/linux/mm.h~mm-ksm-fix-flag-dropping-behavior-in-ksm_madvise
>> +++ a/include/linux/mm.h
>> @@ -296,7 +296,7 @@ extern unsigned int kobjsize(const void
>> #define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */
>> #define VM_HUGEPAGE 0x20000000 /* MADV_HUGEPAGE marked this vma */
>> #define VM_NOHUGEPAGE 0x40000000 /* MADV_NOHUGEPAGE marked this vma */
>> -#define VM_MERGEABLE 0x80000000 /* KSM may merge identical pages */
>> +#define VM_MERGEABLE BIT(31) /* KSM may merge identical pages */
>>
>> #ifdef CONFIG_ARCH_USES_HIGH_VMA_FLAGS
>> #define VM_HIGH_ARCH_BIT_0 32 /* bit only usable on 64-bit architectures */
>
> Yeah, non-trivial macros confuse `bindgen`.
>
> For the moment, you can do e.g. [1].
>
> Other times, we have changed `#define`s into `enum`s -- that also works.
It seems like bindgen's --clang-macro-fallback argument can avoid the
entire class of problems, is there some reason Rust for Linux has avoided
that option?
Although, in order to make it work with fixdep, additional somewhat complex
build system changes are required. I've got it to almost work locally just
now... :)
thanks,
John Hubbard
>
> I hope that helps.
>
> Cheers,
> Miguel
>
> [1]
>
> diff --git a/rust/bindings/bindings_helper.h b/rust/bindings/bindings_helper.h
> index 5128e2f12038..918f4c74067b 100644
> --- a/rust/bindings/bindings_helper.h
> +++ b/rust/bindings/bindings_helper.h
> @@ -106,3 +106,5 @@ const xa_mark_t RUST_CONST_HELPER_XA_PRESENT = XA_PRESENT;
>
> const gfp_t RUST_CONST_HELPER_XA_FLAGS_ALLOC = XA_FLAGS_ALLOC;
> const gfp_t RUST_CONST_HELPER_XA_FLAGS_ALLOC1 = XA_FLAGS_ALLOC1;
> +
> +const vm_flags_t RUST_CONST_HELPER_VM_MERGEABLE = VM_MERGEABLE;
>
next prev parent reply other threads:[~2025-10-02 21:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-02 20:52 [linux-next:master 13069/13300] error[E0425]: cannot find value `VM_MERGEABLE` in crate `bindings` kernel test robot
2025-10-02 21:19 ` Andrew Morton
2025-10-02 21:42 ` Miguel Ojeda
2025-10-02 21:51 ` John Hubbard [this message]
2025-10-02 22:11 ` Miguel Ojeda
2025-10-02 22:27 ` Andrew Morton
2025-10-02 22:32 ` Alice Ryhl
2025-10-02 22:39 ` Miguel Ojeda
2025-10-02 22:43 ` Andrew Morton
2025-10-02 22:50 ` Alice Ryhl
2025-10-02 22:50 ` Miguel Ojeda
2025-10-02 23:16 ` Miguel Ojeda
2025-10-03 0:24 ` John Hubbard
2025-10-07 7:07 ` Jakub Acs
2025-10-07 7:15 ` Alice Ryhl
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=5467d9cc-54c3-415c-9ddd-a1ff1026f29e@nvidia.com \
--to=jhubbard@nvidia.com \
--cc=acsjakub@amazon.de \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--cc=llvm@lists.linux.dev \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=rust-for-linux@vger.kernel.org \
/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