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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C0906C433F5 for ; Sun, 17 Apr 2022 08:32:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=q0ULF0cYL+Rlpe4jn4TyXdGGPbVXQ2NvpSnQwn5783Y=; b=d4AEvRjnkscrMz KZD2rcM6VGA02+hVf3iwkXVjOWIHNQMmWbrNkJnjbOjC2I5uvDug9mMHV8YWEydaiZusRWZbMrtUF k3odZnl98nuXduB4KSUSB+BLPQOYlzvq9QLchmkFhLx4fB/JRQ4oah7u7trrz6G4I8/zX0SDvjy48 9eMS30sDHf7kXnEcOTRQ5WwO7RAb7b6iu36BEAZJeJn0fHsS7LzHyPhpEyN6unEednx3X0vzfQEq2 X1uf0zL6eMk18I28ofivws8ToKEsbmeiiOA9zRv9I9pff4FShr8OqLIpTtE5Q2qub5gWXhLb3sumf SP3/o5+z+6tKo98F6ztg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ng0JU-00E5Sg-6H; Sun, 17 Apr 2022 08:31:20 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ng0JQ-00E5Rm-SF for linux-arm-kernel@lists.infradead.org; Sun, 17 Apr 2022 08:31:18 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BF8B361154; Sun, 17 Apr 2022 08:31:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03810C385A4; Sun, 17 Apr 2022 08:31:12 +0000 (UTC) Date: Sun, 17 Apr 2022 09:31:09 +0100 From: Catalin Marinas To: Herbert Xu Cc: Ard Biesheuvel , Will Deacon , Marc Zyngier , Arnd Bergmann , Greg Kroah-Hartman , Andrew Morton , Linus Torvalds , Linux Memory Management List , Linux ARM , Linux Kernel Mailing List , "David S. Miller" Subject: Re: [PATCH 07/10] crypto: Use ARCH_DMA_MINALIGN instead of ARCH_KMALLOC_MINALIGN Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220417_013116_987141_D9E49EEF X-CRM114-Status: GOOD ( 16.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sun, Apr 17, 2022 at 04:08:22PM +0800, Herbert Xu wrote: > On Fri, Apr 15, 2022 at 01:38:15PM +0200, Ard Biesheuvel wrote: > > If this is the case, things are already broken today. We never take > > ARCH_DMA_MINALIGN into account when adding the driver ctx size to the > > overall allocation size. > > No it's not broken because kmalloc guarantees alignment. For > example, if ARCH_DMA_MINALIGN is 128 bytes, then kmalloc will > always return a pointer that's 128-byte aligned. That guarantees > this object and the next object are on different cache-lines. > > If you reduce the kmalloc minimum alignment to 64 bytes, then > the two neighbouring objects can share cache-lines, even if > each object is bigger than 128 bytes (e.g., if they were 192 > bytes each). Not with my series, the non-sharing of cache lines is preserved. kmalloc() still returns objects aligned to a cache-line. ARCH_DMA_MINALIGN was chosen as the cover-all value for all SoCs supported but I want to reduce the kmalloc() alignment to a cache line size if a platform has a cache line smaller than ARCH_DMA_MINALIGN (most arm64 SoCs have a cache line of 64 bytes rather than 128). -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel