public inbox for linux-next@vger.kernel.org 
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb•auug.org.au>
To: Andrew Morton <akpm@linux-foundation•org>,
	Simona Vetter <simona.vetter@ffwll•ch>
Cc: Danilo Krummrich <dakr@kernel•org>,
	Vitaly Wool <vitaly.wool@konsulko•se>,
	Intel Graphics <intel-gfx@lists•freedesktop.org>,
	DRI <dri-devel@lists•freedesktop.org>,
	Linux Kernel Mailing List <linux-kernel@vger•kernel.org>,
	Linux Next Mailing List <linux-next@vger•kernel.org>
Subject: linux-next: manual merge of the mm-unstable tree with the drm-misc-fixes tree
Date: Wed, 13 Aug 2025 11:11:51 +1000	[thread overview]
Message-ID: <20250813111151.6a261ca1@canb.auug.org.au> (raw)

[-- Attachment #1: Type: text/plain, Size: 4149 bytes --]

Hi all,

Today's linux-next merge of the mm-unstable tree got a conflict in:

  rust/kernel/alloc/allocator.rs

between commit:

  fde578c86281 ("rust: alloc: replace aligned_size() with Kmalloc::aligned_layout()")

from the drm-misc-fixes tree and commit:

  cda097b07bce ("rust: support large alignments in allocations")

from the mm-unstable tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc rust/kernel/alloc/allocator.rs
index 2692cf90c948,63f271624428..000000000000
--- a/rust/kernel/alloc/allocator.rs
+++ b/rust/kernel/alloc/allocator.rs
@@@ -43,11 -42,28 +42,17 @@@ pub struct Vmalloc
  /// For more details see [self].
  pub struct KVmalloc;
  
 -/// Returns a proper size to alloc a new object aligned to `new_layout`'s alignment.
 -fn aligned_size(new_layout: Layout) -> usize {
 -    // Customized layouts from `Layout::from_size_align()` can have size < align, so pad first.
 -    let layout = new_layout.pad_to_align();
 -
 -    // Note that `layout.size()` (after padding) is guaranteed to be a multiple of `layout.align()`
 -    // which together with the slab guarantees means the `krealloc` will return a properly aligned
 -    // object (see comments in `kmalloc()` for more information).
 -    layout.size()
 -}
 -
  /// # Invariants
  ///
- /// One of the following: `krealloc`, `vrealloc`, `kvrealloc`.
+ /// One of the following: `krealloc_node_align`, `vrealloc_node_align`, `kvrealloc_node_align`.
  struct ReallocFunc(
-     unsafe extern "C" fn(*const crate::ffi::c_void, usize, u32) -> *mut crate::ffi::c_void,
+     unsafe extern "C" fn(
+         *const crate::ffi::c_void,
+         usize,
+         crate::ffi::c_ulong,
+         u32,
+         crate::ffi::c_int,
+     ) -> *mut crate::ffi::c_void,
  );
  
  impl ReallocFunc {
@@@ -76,8 -92,9 +81,9 @@@
          layout: Layout,
          old_layout: Layout,
          flags: Flags,
+         nid: NumaNode,
      ) -> Result<NonNull<[u8]>, AllocError> {
 -        let size = aligned_size(layout);
 +        let size = layout.size();
          let ptr = match ptr {
              Some(ptr) => {
                  if old_layout.size() == 0 {
@@@ -134,11 -140,10 +140,12 @@@ unsafe impl Allocator for Kmalloc 
          layout: Layout,
          old_layout: Layout,
          flags: Flags,
+         nid: NumaNode,
      ) -> Result<NonNull<[u8]>, AllocError> {
 +        let layout = Kmalloc::aligned_layout(layout);
 +
          // SAFETY: `ReallocFunc::call` has the same safety requirements as `Allocator::realloc`.
-         unsafe { ReallocFunc::KREALLOC.call(ptr, layout, old_layout, flags) }
+         unsafe { ReallocFunc::KREALLOC.call(ptr, layout, old_layout, flags, nid) }
      }
  }
  
@@@ -177,19 -177,10 +179,14 @@@ unsafe impl Allocator for KVmalloc 
          layout: Layout,
          old_layout: Layout,
          flags: Flags,
+         nid: NumaNode,
      ) -> Result<NonNull<[u8]>, AllocError> {
 +        // `KVmalloc` may use the `Kmalloc` backend, hence we have to enforce a `Kmalloc`
 +        // compatible layout.
 +        let layout = Kmalloc::aligned_layout(layout);
 +
-         // TODO: Support alignments larger than PAGE_SIZE.
-         if layout.align() > bindings::PAGE_SIZE {
-             pr_warn!("KVmalloc does not support alignments larger than PAGE_SIZE yet.\n");
-             return Err(AllocError);
-         }
- 
          // SAFETY: If not `None`, `ptr` is guaranteed to point to valid memory, which was previously
          // allocated with this `Allocator`.
-         unsafe { ReallocFunc::KVREALLOC.call(ptr, layout, old_layout, flags) }
+         unsafe { ReallocFunc::KVREALLOC.call(ptr, layout, old_layout, flags, nid) }
      }
  }

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

             reply	other threads:[~2025-08-13  1:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-13  1:11 Stephen Rothwell [this message]
2025-08-13  3:59 ` linux-next: manual merge of the mm-unstable tree with the drm-misc-fixes tree Andrew Morton
2025-08-13  9:07   ` Danilo Krummrich
2025-08-13  8:50 ` Danilo Krummrich

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=20250813111151.6a261ca1@canb.auug.org.au \
    --to=sfr@canb$(echo .)auug.org.au \
    --cc=akpm@linux-foundation$(echo .)org \
    --cc=dakr@kernel$(echo .)org \
    --cc=dri-devel@lists$(echo .)freedesktop.org \
    --cc=intel-gfx@lists$(echo .)freedesktop.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-next@vger$(echo .)kernel.org \
    --cc=simona.vetter@ffwll$(echo .)ch \
    --cc=vitaly.wool@konsulko$(echo .)se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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