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 577F2C25B75 for ; Fri, 31 May 2024 16:50:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E7FCD6B00B7; Fri, 31 May 2024 12:50:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E2EAC6B00B8; Fri, 31 May 2024 12:50:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CF6586B00B9; Fri, 31 May 2024 12:50:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id A95046B00B7 for ; Fri, 31 May 2024 12:50:19 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 65FFBC0C61 for ; Fri, 31 May 2024 16:50:19 +0000 (UTC) X-FDA: 82179278958.18.20E6D71 Received: from out-170.mta1.migadu.com (out-170.mta1.migadu.com [95.215.58.170]) by imf11.hostedemail.com (Postfix) with ESMTP id 9C30240027 for ; Fri, 31 May 2024 16:50:15 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=Bcv4uZSf; spf=pass (imf11.hostedemail.com: domain of kent.overstreet@linux.dev designates 95.215.58.170 as permitted sender) smtp.mailfrom=kent.overstreet@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=1717174216; 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=VEEopXa/6axR2qlwT+N+gjyPs9hJMbVFhL2Ri7Y7Wg4=; b=xncUHT8pBKkVV+0GY0WMrQz0ve5GqU93xjlkiNzP97ySc0sGm+jAPX5em5rUtQAdBDUza+ odxfSCqqdlcR6fXpZbBdwGtO8lgRxCHCuemHw+8ijwoCDxNotvCBeMHDYNhQ84KZBbWjiT dmN3TjRwdYBEZbmjzg/m2myVTLkoTdA= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=Bcv4uZSf; spf=pass (imf11.hostedemail.com: domain of kent.overstreet@linux.dev designates 95.215.58.170 as permitted sender) smtp.mailfrom=kent.overstreet@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717174216; a=rsa-sha256; cv=none; b=FGVieHVh/t9RKx9wSyjole8LzJFcxpGMqQNecqmJxk4882yvS9SqNxQhuXegBgklwv7tkf 6ZWnHTZA6E8fiKfrrP1HVKed1Z0Tr1CypCzqAOnk9qXjWnmrTwExI/ZKAi2lxqZIbolgDo v6HJliiFAode52OcdO43kGboMwm17vI= X-Envelope-To: kees@kernel.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1717174213; 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=VEEopXa/6axR2qlwT+N+gjyPs9hJMbVFhL2Ri7Y7Wg4=; b=Bcv4uZSfIXwv++7KSEEVLfdODz8CsX7iI+ORptEsJ6KIZ7aQzRHKRGsAkmGcH0q/T5GAFI GFb3ZFZp4vgQsbTlTiSIxol1fLl9iGS/oo7fgJo4VRmS74TN8TVvbMOU/TK9/zEAxLZ4wf Ni5rG8WTUCon886TDWtyjxTtC62/JqY= X-Envelope-To: vbabka@suse.cz X-Envelope-To: cl@linux.com X-Envelope-To: penberg@kernel.org X-Envelope-To: rientjes@google.com X-Envelope-To: iamjoonsoo.kim@lge.com X-Envelope-To: akpm@linux-foundation.org X-Envelope-To: roman.gushchin@linux.dev X-Envelope-To: 42.hyeyoo@gmail.com X-Envelope-To: linux-mm@kvack.org X-Envelope-To: linux-hardening@vger.kernel.org X-Envelope-To: gongruiqi@huaweicloud.com X-Envelope-To: xiujianfeng@huawei.com X-Envelope-To: surenb@google.com X-Envelope-To: jannh@google.com X-Envelope-To: matteorizzo@google.com X-Envelope-To: tgraf@suug.ch X-Envelope-To: herbert@gondor.apana.org.au X-Envelope-To: julien.voisin@dustri.org X-Envelope-To: linux-kernel@vger.kernel.org Date: Fri, 31 May 2024 12:50:08 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Kees Cook Cc: Vlastimil Babka , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, linux-mm@kvack.org, linux-hardening@vger.kernel.org, "GONG, Ruiqi" , Xiu Jianfeng , Suren Baghdasaryan , Jann Horn , Matteo Rizzo , Thomas Graf , Herbert Xu , julien.voisin@dustri.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 2/6] mm/slab: Plumb kmem_buckets into __do_kmalloc_node() Message-ID: <5boulybop2fxtkht7n65r6ktdr5aiedts5xnuadmyr6wvaectx@sbcdzqoljpeh> References: <20240424213019.make.366-kees@kernel.org> <20240424214104.3248214-2-keescook@chromium.org> <202405310943.D9818A4FE@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202405310943.D9818A4FE@keescook> X-Migadu-Flow: FLOW_OUT X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 9C30240027 X-Stat-Signature: csijnn9zobsfm5nceah99rfhxejzzjqi X-Rspam-User: X-HE-Tag: 1717174215-776609 X-HE-Meta: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uA1qe58DGCnL2rEafhmgqMA8k4hKaF3Pd1oj5O1QuAtFLvVKej2z5Lfac2SCKMp1BPWdixlrK456zWTVgY4RX+1XKBPjtJ4yPQl/FCTKkH4Ow 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 Fri, May 31, 2024 at 09:48:49AM -0700, Kees Cook wrote: > On Fri, May 24, 2024 at 11:01:40AM -0400, Kent Overstreet wrote: > > On Wed, Apr 24, 2024 at 02:40:59PM -0700, Kees Cook wrote: > > > To be able to choose which buckets to allocate from, make the buckets > > > available to the lower level kmalloc interfaces by adding them as the > > > first argument. Where the bucket is not available, pass NULL, which means > > > "use the default system kmalloc bucket set" (the prior existing behavior), > > > as implemented in kmalloc_slab(). > > > > I thought the plan was to use codetags for this? That would obviate the > > need for all this plumbing. > > > > Add fields to the alloc tag for: > > - allocation size (or 0 if it's not a compile time constant) > > - union of kmem_cache, kmem_buckets, depending on whether the > > allocation size is constant or not > > I want to provide "simple" (low-hanging fruit) coverage that can live > separately from the codetags-based coverage. The memory overhead for > this patch series is negligible, but I suspect the codetags expansion, > while not giant, will be more than some deployments will want. I want > to avoid an all-or-nothing solution -- which is why I had intended this > to be available "by default". You don't need to include the full codetag + alloc tag counters - with the appropriate #ifdefs the overhead will be negligable.