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 44DA1C433FE for ; Wed, 26 Oct 2022 06:39:20 +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=pXGQvnHgA5KuuzdRhRoMn3Ri8/OVwFdL8IIEGXQ3YRU=; b=y0pAicSc6Df2Hl FnoUzq4/lSbqGb6CQ1wgi806wTBopZwMvRcDJ3XDRv7mHm5ISBZ1p61dnTW5Zhfd+5ckaWw1Fn641 fvF6ryPSH/kZI+Gnh9oGIzBsYgEkgmDtNVSdQlPg5VzGJ32VNaX8FlssBzgvyHqH9d4b4jy9OwZ5d uki5aw8Ql4E4nulZTpT6EertARBPp/LWUpAQY5uK0U1PLsEi2OvrOMhmsYf5mHEd0BmQMknPdS4Kj KF6mgDh6DboIAka8zAROeyrcOV1+IGshmOk7YjvBsICZr8hJcRgi4y46Xo0QaxTGNoGIaz7DZ0ezW MwMFW6Wmsxv7ebMlrB9g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ona3Q-008HCf-K6; Wed, 26 Oct 2022 06:38:20 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ona3K-008HB4-FC for linux-arm-kernel@lists.infradead.org; Wed, 26 Oct 2022 06:38: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 ams.source.kernel.org (Postfix) with ESMTPS id EDC86B8210F; Wed, 26 Oct 2022 06:38:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19C34C433D6; Wed, 26 Oct 2022 06:38:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666766291; bh=IB6EFj6yQcmZCVEW0m45KB/WS+HpafIDLDMPLeiYKg8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hm5ktEj67UG7/zbNhjZ3SxFL9ifmNsps39GrBkjyxgWTpShifg5rKlSwYhpJPKQ1E 9n4jBebzan6+FwiwfjlZ1Rpf3psEmOLGknx9bE2pQy9HpXQPBAwJwWfRrRWBKTbti3 YOvJYneleNxdzDjUrVCq4vGOrvcrFqBeyqx3d9wM= Date: Wed, 26 Oct 2022 08:39:04 +0200 From: Greg Kroah-Hartman To: Catalin Marinas Cc: Linus Torvalds , Arnd Bergmann , Will Deacon , Marc Zyngier , Andrew Morton , Herbert Xu , Ard Biesheuvel , Christoph Hellwig , Isaac Manjarres , Saravana Kannan , linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 1/2] mm: slab: Introduce __GFP_PACKED for smaller kmalloc() alignments Message-ID: References: <20221025205247.3264568-1-catalin.marinas@arm.com> <20221025205247.3264568-2-catalin.marinas@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20221025205247.3264568-2-catalin.marinas@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221025_233814_674023_C05B102D X-CRM114-Status: GOOD ( 16.80 ) 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 Tue, Oct 25, 2022 at 09:52:46PM +0100, Catalin Marinas wrote: > By default kmalloc() returns objects aligned to ARCH_KMALLOC_MINALIGN. > This can be somewhat large on architectures defining ARCH_DMA_MINALIGN > (e.g. 128 on arm64) and significant memory is wasted through small > kmalloc() allocations. > > Reduce the minimum alignment for kmalloc() to the default > KMALLOC_MIN_SIZE (8 for slub, 32 for slab) but align the > requested size to the bigger ARCH_KMALLOC_MINALIGN unless a newly added > __GFP_PACKED flag is passed. With this gfp flag, the alignment is > reduced to KMALLOC_PACKED_ALIGN, at least sizeof(unsigned long long). Can memory allocated with __GFP_PACKED be sent to DMA controllers? If not, you should say that somewhere here or I'm going to get a bunch of patches trying to add this flag to tiny USB urb allocations (where we allocate 8 or 16 bytes) that is then going to fail on some hardware. thanks, greg k-h _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel