From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5772CA90AF for ; Wed, 13 May 2020 13:50:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1C2142054F for ; Wed, 13 May 2020 13:50:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387768AbgEMNut convert rfc822-to-8bit (ORCPT ); Wed, 13 May 2020 09:50:49 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([146.101.78.151]:54055 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727792AbgEMNut (ORCPT ); Wed, 13 May 2020 09:50:49 -0400 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-207-7QlvMga7Ot6aVhvjyH0N6g-1; Wed, 13 May 2020 14:50:45 +0100 X-MC-Unique: 7QlvMga7Ot6aVhvjyH0N6g-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Wed, 13 May 2020 14:50:44 +0100 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Wed, 13 May 2020 14:50:44 +0100 From: David Laight To: 'Peter Zijlstra' CC: 'Geert Uytterhoeven' , Greg Kroah-Hartman , Lee Jones , stable , Alexey Brodkin , Alexey Brodkin , Thomas Gleixner , Vineet Gupta , Will Deacon Subject: RE: [PATCH 4.4 03/16] devres: Align data[] to ARCH_KMALLOC_MINALIGN Thread-Topic: [PATCH 4.4 03/16] devres: Align data[] to ARCH_KMALLOC_MINALIGN Thread-Index: AQHWKQu4HYgJHBu5S0KOdh+8IRi0tqilymPggAAprYCAABK8AA== Date: Wed, 13 May 2020 13:50:44 +0000 Message-ID: <94541c2ec85e4b2589dc8902ef2c4f41@AcuMS.aculab.com> References: <20200423204014.784944-1-lee.jones@linaro.org> <20200423204014.784944-4-lee.jones@linaro.org> <20200513093536.GB830571@kroah.com> <335fbcc7d9ad4d429ec11e9ac2caf118@AcuMS.aculab.com> <20200513133609.GO2978@hirez.programming.kicks-ass.net> In-Reply-To: <20200513133609.GO2978@hirez.programming.kicks-ass.net> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 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@hirez.programming.kicks-ass.net 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)