RE: [PATCH 4.4 03/16] devres: Align data[] to ARCH_KMALLOC_MINALIGN

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Peter Zijlstra
> Sent: 13 May 2020 14:36
> 
> On Wed, May 13, 2020 at 10:10:03AM +0000, David Laight wrote:
> > From: Geert Uytterhoeven
> > > Sent: 13 May 2020 10:49
> > ...
> > > > I don't want to apply this to older kernels as it could cause extra
> > > > memory usage for no good reason.  I have no idea why a non ARC system
> > > > would want it :(
> > >
> > > I think the reference to ARC is a red herring.
> > > The real issue is that buffers used for DMA may not have the required
> > > alignment, which is not limited to ARC systems.
> > >
> > > Note that I'm also not super happy with the extra memory usage.
> > > But devm_*() conveniences come with their penalties...
> >
> > Interesting thought.
> > Could the devm 'header' be put right at the end of the kmalloc()
> > buffer?
> 
> https://lkml.kernel.org/r/20191220140655.GN2827@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

All the way around the loop.....

ISTR there have also been issues with one of the kmalloc() implementations
adding a header to the memory block.
Didn't it generate 4n+2 aligned buffers on m68k - breaking code that
tried to use the two lower bits of an address.

If one of the kmalloc()s behaves like that it ought to be possible
for devm_alloc() to use the spare space in the same cache line??

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux