On Mon, Nov 09, 2026 at 05:32:50PM +0900, Eliot Courtney wrote: > Use `SizeConstants` for Alignment that are implemented now. > > Reviewed-by: Alexandre Courbot <[email protected]> > Reviewed-by: Alice Ryhl <[email protected]> > Signed-off-by: Eliot Courtney <[email protected]>
Reviewed-by: Yury Norov <[email protected]> > --- > rust/kernel/gpu/buddy.rs | 26 +++++++++++++------------- > 1 file changed, 13 insertions(+), 13 deletions(-) > > diff --git a/rust/kernel/gpu/buddy.rs b/rust/kernel/gpu/buddy.rs > index d502ada6ebbd..691bb40629d4 100644 > --- a/rust/kernel/gpu/buddy.rs > +++ b/rust/kernel/gpu/buddy.rs > @@ -31,11 +31,11 @@ > //! let buddy = GpuBuddy::new(GpuBuddyParams { > //! base_offset: 0, > //! size: SZ_1G as u64, > -//! chunk_size: Alignment::new::<SZ_4K>(), > +//! chunk_size: Alignment::SZ_4K, > //! })?; > //! > //! assert_eq!(buddy.size(), SZ_1G as u64); > -//! assert_eq!(buddy.chunk_size(), Alignment::new::<SZ_4K>()); > +//! assert_eq!(buddy.chunk_size(), Alignment::SZ_4K); > //! let initial_free = buddy.avail(); > //! > //! // Allocate 16MB. Block lands at the top of the address range. > @@ -43,7 +43,7 @@ > //! buddy.alloc_blocks( > //! GpuBuddyAllocMode::Simple, > //! SZ_16M as u64, > -//! Alignment::new::<SZ_16M>(), > +//! Alignment::SZ_16M, > //! GpuBuddyAllocFlags::default(), > //! ), > //! GFP_KERNEL, > @@ -74,14 +74,14 @@ > //! # let buddy = GpuBuddy::new(GpuBuddyParams { > //! # base_offset: 0, > //! # size: SZ_1G as u64, > -//! # chunk_size: Alignment::new::<SZ_4K>(), > +//! # chunk_size: Alignment::SZ_4K, > //! # })?; > //! # let initial_free = buddy.avail(); > //! let topdown = KBox::pin_init( > //! buddy.alloc_blocks( > //! GpuBuddyAllocMode::TopDown, > //! SZ_16M as u64, > -//! Alignment::new::<SZ_16M>(), > +//! Alignment::SZ_16M, > //! GpuBuddyAllocFlags::default(), > //! ), > //! GFP_KERNEL, > @@ -114,7 +114,7 @@ > //! # let buddy = GpuBuddy::new(GpuBuddyParams { > //! # base_offset: 0, > //! # size: SZ_1G as u64, > -//! # chunk_size: Alignment::new::<SZ_4K>(), > +//! # chunk_size: Alignment::SZ_4K, > //! # })?; > //! # let initial_free = buddy.avail(); > //! // Create fragmentation by allocating 4MB blocks at [0,4M) and [8M,12M). > @@ -122,7 +122,7 @@ > //! buddy.alloc_blocks( > //! GpuBuddyAllocMode::Range(0..SZ_4M as u64), > //! SZ_4M as u64, > -//! Alignment::new::<SZ_4M>(), > +//! Alignment::SZ_4M, > //! GpuBuddyAllocFlags::default(), > //! ), > //! GFP_KERNEL, > @@ -133,7 +133,7 @@ > //! buddy.alloc_blocks( > //! GpuBuddyAllocMode::Range(SZ_8M as u64..(SZ_8M + SZ_4M) as u64), > //! SZ_4M as u64, > -//! Alignment::new::<SZ_4M>(), > +//! Alignment::SZ_4M, > //! GpuBuddyAllocFlags::default(), > //! ), > //! GFP_KERNEL, > @@ -145,7 +145,7 @@ > //! buddy.alloc_blocks( > //! GpuBuddyAllocMode::Range(0..SZ_16M as u64), > //! SZ_8M as u64, > -//! Alignment::new::<SZ_4M>(), > +//! Alignment::SZ_4M, > //! GpuBuddyAllocFlags::default(), > //! ), > //! GFP_KERNEL, > @@ -178,14 +178,14 @@ > //! let small = GpuBuddy::new(GpuBuddyParams { > //! base_offset: 0, > //! size: SZ_16M as u64, > -//! chunk_size: Alignment::new::<SZ_4K>(), > +//! chunk_size: Alignment::SZ_4K, > //! })?; > //! > //! let _hole1 = KBox::pin_init( > //! small.alloc_blocks( > //! GpuBuddyAllocMode::Range(0..SZ_4M as u64), > //! SZ_4M as u64, > -//! Alignment::new::<SZ_4M>(), > +//! Alignment::SZ_4M, > //! GpuBuddyAllocFlags::default(), > //! ), > //! GFP_KERNEL, > @@ -195,7 +195,7 @@ > //! small.alloc_blocks( > //! GpuBuddyAllocMode::Range(SZ_8M as u64..(SZ_8M + SZ_4M) as u64), > //! SZ_4M as u64, > -//! Alignment::new::<SZ_4M>(), > +//! Alignment::SZ_4M, > //! GpuBuddyAllocFlags::default(), > //! ), > //! GFP_KERNEL, > @@ -206,7 +206,7 @@ > //! small.alloc_blocks( > //! GpuBuddyAllocMode::Simple, > //! SZ_8M as u64, > -//! Alignment::new::<SZ_4M>(), > +//! Alignment::SZ_4M, > //! GpuBuddyAllocFlag::Contiguous, > //! ), > //! GFP_KERNEL, > > -- > 2.56.0 >
