Received: by 2002:a05:7412:e79e:b0:f3:1519:9f41 with SMTP id o30csp60304rdd; Wed, 22 Nov 2023 09:21:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IF29qSJyij2zRVeNrIEoWtEqZHavwUk2Cf5QdleAQVlA3qgWD7p2ibbtAydzCtaodt1xMuk X-Received: by 2002:a17:902:db02:b0:1cc:7f53:c190 with SMTP id m2-20020a170902db0200b001cc7f53c190mr3910856plx.51.1700673682850; Wed, 22 Nov 2023 09:21:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700673682; cv=none; d=google.com; s=arc-20160816; b=m3Bi91oROcyVv7rNpGG7OHI3Tk48Is5hZXWWAG2qRT1SRbkg6w64VSR5YR/Mo3JIuZ LIpBQ072pVhK89XmN0Dh/juJxjr2FobDc+TV6GuWNhtx3MhIkv4LDI7Tcr8n2/iKtUB1 rc1f7vGxsLM3RDW6LtNdKE4bC7rneFF7QJeqWKj+ya0qjfKceq5MT+cPtnLH5RvViOvl Q+KTbjtwvKJKf4UEdAPpvGtXRTtUjHvPNLwkVuLgdhew6GIPYK8xybpCZZv0hJ1TdG49 VHIqihxzdG6j0Ey2JTO8OFsOmP4udtR0zwKflETXr0Tlk92Pys+j/awhNzR4ucVsBLnU skrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=hVowPfOdM8wVDD7Ux+I97nRKLe3FJvmMPxWZObEYXX4=; fh=Avg7wGSBRsZ0DIpZn8URTxt87FNBdQgwxmFYDqTvEPg=; b=W7KeCV0TnTdlx7s+ef9is9efhZV3MHYDFcXStG+pT+Kbbj/iplWqenLF73/ztljSTG LGLG7E/SeFfW9Yh0VcbfbsIk6a7icX2AphBW7FHOgcaEaysvCxe63g3+q/+DQq6d7UHP 6EHNfbK/fyYLOQpFp5IphArTuuMRuUBpK5WDHbvbDo2/8pcs8GWHBUU8gkp6pdQ28Qf9 JeJQi+9wmGjMsJcOQuDG2Q+MCJlJ3xCwNsYrZELAxT7lq+LRtnT15WeYBcNzOFlRtKZO RfSQRY4aq4cHexz40sr4lv9MX3Jeml+CaljGwA/XjqMTTvZTaNXqTZqx9r+IdNvH5KMY ZosQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=MX4BbBxX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id x18-20020a170902ea9200b001ce08dcbb84si12422100plb.614.2023.11.22.09.21.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 09:21:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=MX4BbBxX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id CB47681B5A90; Wed, 22 Nov 2023 09:21:18 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344017AbjKVRVL (ORCPT + 99 others); Wed, 22 Nov 2023 12:21:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231793AbjKVRVJ (ORCPT ); Wed, 22 Nov 2023 12:21:09 -0500 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E66B11F for ; Wed, 22 Nov 2023 09:21:05 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-40b27b498c3so15826445e9.0 for ; Wed, 22 Nov 2023 09:21:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1700673664; x=1701278464; darn=vger.kernel.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=hVowPfOdM8wVDD7Ux+I97nRKLe3FJvmMPxWZObEYXX4=; b=MX4BbBxXUOHuFidLBa4CRy6+WzCpXfHATM2a6dzEstDLkOG3x43shZWpoZzAYYk1sO QGOTcO057sX722XS8qF90lSH6pweHqCqtYw7H7u3T3UG/IB59YMJui1g/XgzzeilceeH wiCqSNuCOh5r/2PrRMrsp/1pcGMKYzECjwBOy9/kLP0ybUTvq9UNZagiojhu8cd2Vq+f AHu5DFSAMwT0nWP9aXGx/jhxTe5+GC8LED58ak56EQrsDPK9z0BD6tCqCAM5zNK5jGdi oqPFrFusDB5VRvCrLkNNMcDRHvMTZF8zD7ZNoIoRDELEU+nuBJujUArw8UIQV3Fo4aqR 5pkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700673664; x=1701278464; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hVowPfOdM8wVDD7Ux+I97nRKLe3FJvmMPxWZObEYXX4=; b=CdsKdQiNoOpmCLEdwV2ugjz3ZQFb0EQSiKqP0/bpvRQM8Cih3159vza2bhW+TAghtj jY/KTaw2PrBD9xc7DsrcQer+XHtrB2/llks0RGRMS4XY/OdAtrcW+6ebe+88eCggIG7b tQmpxGcjsVyB4XwzSjD2Wuj0/2JvHehFB0TckkDYExkxmtq48l12GrSqSk3CpodmJSnJ Prh+4j0nvqlS8xbBCq5vQgDyrSfVfIOWNLgDMuo+l6m7qMxZ0CHQPNXyzBbdSCvdqDvc Hn5KraPUp0vFMUHzDHPvX3SOP4d1Un2o4CDAOLF7xWoSSf59Yh3owBDdN6d0rTRaWSCg O+Ug== X-Gm-Message-State: AOJu0YwXAHXHvTKs+P4TlDj9Nrxqf9yCUivs6g8ZbpNtLrZOclhAMZJD Dv4NnYrgjiZe45A2PYKAoO0YfQ== X-Received: by 2002:a05:6000:128e:b0:332:ce86:cc35 with SMTP id f14-20020a056000128e00b00332ce86cc35mr1828909wrx.71.1700673663968; Wed, 22 Nov 2023 09:21:03 -0800 (PST) Received: from elver.google.com ([2a00:79e0:9c:201:1dcf:36df:c2d9:af51]) by smtp.gmail.com with ESMTPSA id d19-20020adf9b93000000b003316eb9db40sm15549737wrc.51.2023.11.22.09.21.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 09:21:03 -0800 (PST) Date: Wed, 22 Nov 2023 18:20:57 +0100 From: Marco Elver To: andrey.konovalov@linux.dev Cc: Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Andrey Ryabinin , kasan-dev@googlegroups.com, Evgenii Stepanov , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: Re: [PATCH RFC 14/20] mempool: introduce mempool_use_prealloc_only Message-ID: References: <9752c5fc4763e7533a44a7c9368f056c47b52f34.1699297309.git.andreyknvl@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9752c5fc4763e7533a44a7c9368f056c47b52f34.1699297309.git.andreyknvl@google.com> User-Agent: Mutt/2.2.12 (2023-09-09) X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 22 Nov 2023 09:21:19 -0800 (PST) On Mon, Nov 06, 2023 at 09:10PM +0100, andrey.konovalov@linux.dev wrote: > From: Andrey Konovalov > > Introduce a new mempool_use_prealloc_only API that tells the mempool to > only use the elements preallocated during the mempool's creation and to > not attempt allocating new ones. > > This API is required to test the KASAN poisoning/unpoisoning functinality > in KASAN tests, but it might be also useful on its own. > > Signed-off-by: Andrey Konovalov > --- > include/linux/mempool.h | 2 ++ > mm/mempool.c | 27 ++++++++++++++++++++++++--- > 2 files changed, 26 insertions(+), 3 deletions(-) > > diff --git a/include/linux/mempool.h b/include/linux/mempool.h > index 4aae6c06c5f2..822adf1e7567 100644 > --- a/include/linux/mempool.h > +++ b/include/linux/mempool.h > @@ -18,6 +18,7 @@ typedef struct mempool_s { > int min_nr; /* nr of elements at *elements */ > int curr_nr; /* Current nr of elements at *elements */ > void **elements; > + bool use_prealloc_only; /* Use only preallocated elements */ This increases the struct size from 56 to 64 bytes (64 bit arch). mempool_t is embedded in lots of other larger structs, and this may result in some unwanted bloat. Is there a way to achieve the same thing without adding a new bool to the mempool struct? It seems a little excessive only for the purpose of the tests.