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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BFEFC30658 for ; Tue, 2 Jul 2024 21:13:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 63BA96B0089; Tue, 2 Jul 2024 17:13:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5EB6C6B008A; Tue, 2 Jul 2024 17:13:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4B3446B008C; Tue, 2 Jul 2024 17:13:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 2F2A26B0089 for ; Tue, 2 Jul 2024 17:13:16 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 965E61A05E7 for ; Tue, 2 Jul 2024 21:13:15 +0000 (UTC) X-FDA: 82296063150.25.69E4D06 Received: from out-173.mta0.migadu.com (out-173.mta0.migadu.com [91.218.175.173]) by imf13.hostedemail.com (Postfix) with ESMTP id 2E2292000B for ; Tue, 2 Jul 2024 21:13:11 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=bcI9T0GY; spf=pass (imf13.hostedemail.com: domain of roman.gushchin@linux.dev designates 91.218.175.173 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719954780; a=rsa-sha256; cv=none; b=goSiWoKLPZ/sYyiTVcWdyQPQ1bu8X8NqRGu/MBXjVHLuL43a5/5Cw8L7szRRIr3q9GYOfR IWULIN/SrtEACDRwXSbpCH9wnc23kxYfbqPG57jWOCG2S9zvdBgNzfdu9tO1JiLhr2OB6A 6RuhOe2BTRA+k9u0SmC7NaAGFr1Ki2I= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=bcI9T0GY; spf=pass (imf13.hostedemail.com: domain of roman.gushchin@linux.dev designates 91.218.175.173 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719954780; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=TnOurbSGAywWjCC55R7y4gHWEoqmY93tzoWLEfbrmLc=; b=pNRwiseoxl+bJgkUPPxvmkvGkH5PMyKkycyQLTUVJTfgqYgYrAtcbg4uQWXhE7XddKOml5 TzQ+ARBGhZtKeVBmlpciHvPFphzDvJSSjgeXP5Fb+VpqwnKJ+kfrbFsc4PbVGxlflu94ex SDXUZTnXNCDMkMdZ39K0kSRilU1h5l4= X-Envelope-To: vbabka@suse.cz DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1719954789; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=TnOurbSGAywWjCC55R7y4gHWEoqmY93tzoWLEfbrmLc=; b=bcI9T0GY0ZpoohlzKj+D9VwwrP/xSgfqxn9zKjrSBMkLN3WtTibw4BqsvfHlN/m0Z2331i vqBepPYGbQWRuBJs7/+EA7Py2jAHLadSAA4H79mk0Gd3voxyFxrnV7AzXtWfKdqtLVR93i yrsadAIhJM+1X880KcU1N9k04KU08QM= X-Envelope-To: linux-mm@kvack.org X-Envelope-To: rientjes@google.com X-Envelope-To: cl@linux.com X-Envelope-To: 42.hyeyoo@gmail.com X-Envelope-To: keescook@chromium.org X-Envelope-To: aliceryhl@google.com X-Envelope-To: boqun.feng@gmail.com X-Envelope-To: rust-for-linux@vger.kernel.org X-Envelope-To: linux-kernel@vger.kernel.org X-Envelope-To: patches@lists.linux.dev Date: Tue, 2 Jul 2024 21:13:02 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Roman Gushchin To: Vlastimil Babka Cc: linux-mm@kvack.org, David Rientjes , Christoph Lameter , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Kees Cook , Alice Ryhl , Boqun Feng , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev Subject: Re: [PATCH] mm, slab: extend kmalloc() alignment for non power-of-two sizes Message-ID: References: <20240702155800.166503-2-vbabka@suse.cz> <1ca7b081-c1f0-45a3-b901-39c503368f43@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1ca7b081-c1f0-45a3-b901-39c503368f43@suse.cz> X-Migadu-Flow: FLOW_OUT X-Stat-Signature: heh7oc8ondru5dw3rrwsxp3dbnr8679i X-Rspamd-Queue-Id: 2E2292000B X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1719954791-226729 X-HE-Meta: U2FsdGVkX19aJ4A4hsy/OWjIGZ9eEbLuFXT+T2JDmCvRbS0RpkvFVR2YeL2oV50njE+DJcQ5DIws+Qf88QL/zpbx5sA8Xet9neVH0BbzD2VlT/8+X/urdmPskSeqscV3CRODMhnG1Ruc3eYmwCUuQWbnkaDzgJZyfOlUdLk7Yx1BKc8tocUos4Z+TDAKgWvIOjHYbObBfGk8MlASKWg9U7s+gwvoLFlBAALqEdNiASizce9ZXG6JRQ46JYW2/p1qW/2If/J+FBeWQ9wEZeKEyxK2iBlW+P1IoGfvwvVmfKQ1/DAakP4YZ1XMTjgzx3jEpD31l+OyxbsRKptVjxlVPFp66svXpbnHWA8eGt7AGhXGNlVwQIm6HLHsiMNVYV6f5opa5gVh4VuBHtIJcbWkGEo8SGcU3oQHMZDFk8bpcNMIi6uq3JkBCqRuPPipYZy+EohHNuvk7f6XtO2E46e8/rt2aMFt4E7W+At6SjPy8qMZWAn5FYzk8wMS/TgxA0g3l1dbVo8k4qqNaP4dEO2nfNQnynbK4eIoglLstwe53izqjIeXGOg30KeBHNc7nZNwA+x5PjsKRIw/pDlPJFpwZq5fh7vfCPxyCh3/sZ9tlHuQ0gW4QAr/izYDV0YvdAxLwxqBlE86yeHtUA4izbRZnq5xznGrzstdVh/CtEzmvk+jn1pIIDD+/pc4Q+bjKhYNdnEAGL2cRnpIQhCA7/RDcox+6FXmQR/Lf9GunRxxd8hvmWl54LVZQIK+KtcWo/XUK2HOXsp2CP7hP0sxr49c4aflFLim++Rmv8vINR7rdYzmCnebMaMioxp14zw700YRUqQX0HaZqFb7/aspFfB8cKh5uyo5LxSekTEExGAnR9fI0c0n+pHP1CbyiBE/9gQYEQvuA73UqTQqTzYgr98dgtxQe4m2ItYlCgf/csnAkp9rKn/jWNKDr6KQK8z03f2psOUFglBVKMKEE2Bjwd5 QhbR9lem K9uIYvswchJVo5iYagya6lZOWHUr2VRtDRFeT0OxOMa+fP2vndIh/TBGTRC0xjxxYnFbDYB85ioA71tKrUSPJOAcQBADV1hKIW1XM3r54AziUhHUsrCDL5JAW7MTHoImJZHKn4ngpUhGLrnS+LQPmApkQIqABxz+SZC2ClrP7nVw76jnUWrTn+yus9DKfeGcBctm2JmKvoEr5XVimJnUMek5FH0ZV/imiMIvi X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Tue, Jul 02, 2024 at 10:25:44PM +0200, Vlastimil Babka wrote: > On 7/2/24 9:30 PM, Roman Gushchin wrote: > > On Tue, Jul 02, 2024 at 05:58:01PM +0200, Vlastimil Babka wrote: > > Hello Vlastimil, > > > > the idea and the implementation makes total sense to me. > > > > Do you have an estimate for the memory overhead it will typically introduce? > > There's no new overhead for the non-debug case as the layout already > naturally has the same alignment as is now guaranteed. Debug has its own > overhead so it's enabled only when needed, and this will not add much more. Got it, but can you, please, add this note with some explanation why it's true to the commit message? Because it's not obvious and the commit message makes almost the opposite impression: Slab allocators have been guaranteeing natural alignment for power-of-two sizes <...>, while any other sizes are aligned only to ARCH_KMALLOC_MINALIGN bytes. Should it be "guaranteed to be aligned" vs are actually aligned? > > > I don't think it will be too large though and actually can be compensated > > by potential performance gains due to a better memory alignment. What do you > > think? > > Yeah but again, the difference would be only in the debug case and > performance gains there are not so interesting :) Acked-by: Roman Gushchin Thanks!