Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1778386rdb; Mon, 9 Oct 2023 02:36:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHEIxtPUI5rrVfgJnXhDMFbzYIc22W6c1ESad0YwEMPcrNPQd9SDbHgyk2LMNJoPBEo2dxy X-Received: by 2002:a05:6a20:4290:b0:162:ee29:d3c0 with SMTP id o16-20020a056a20429000b00162ee29d3c0mr18476513pzj.42.1696844188956; Mon, 09 Oct 2023 02:36:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696844188; cv=none; d=google.com; s=arc-20160816; b=AIkgJlvMd9534OoOEYJBkb9IwIqL/pikqPEuYbvcUBIHJ1qJUcETW/63tt3oi9AqtX DNKI89wZBDgpcD2ZrEIWvCGcfV/QCRvygKzbZIjLTQhaRg3hytHNAk1Z6aBeF5spNX3e G0D4AqquQxJg4LOhioyGBzyTBVJgGXNcWPRrAqtIF/xdwGAgGtcp1yhNQYMefw4S/jxb HSaRuGFYWgFl+Fno5U/zBdRF4zsQvkLis1+FXzzDN9yPBlOERyz1W59liJpTXQm3XTDa fqSPPd6+c2G60QixNw8KZp3RnC6W0VLCrytDuA4k28cw3bCNRb/RwjgJ8gqbTumbmdJl QT6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=NbPQn5PYDTYWmHehcflWH6rr2b2zYJNRYM1EffH3dP8=; fh=D7uhrQnmQG6xf11gbvfi3iQ1A4p/6GZN4OQA8frEvwo=; b=w1yA00c3479LGelj+FAKi0CRddc2JfbXAK1XV0xUnYYFgivah/2MXXcO3oPTovCTqv 7U4lqTXL7+UkKUW9MH+I48pyag5o7W/8M5/XFDPQiEjVkcOL3rYH79tGxRVDGUsm22Rv Feul+pTbisSng64YeKXpfhYqafSpRo3oy9S7dkUIi8qocuYaZ9F1PwCKSZYgMSZtioUh AasubkRqfo6/q/2cflCGPTZNbVybZczO3SpHvRIzRmWUF4luMT7z73cnIm4mLlrurD73 pdEGxwkN4zpNadkhzwjg4m6Jk7GFvGoGPvQGB+JZdw3XswVmDl2l9S8gT/dwxnVZu9n+ tzZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=q+zQqYGH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id d17-20020a056a00245100b00696b367da55si7198791pfj.396.2023.10.09.02.36.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 02:36:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=q+zQqYGH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id D09FC807C6FC; Mon, 9 Oct 2023 02:36:26 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345928AbjJIJgU (ORCPT + 99 others); Mon, 9 Oct 2023 05:36:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345875AbjJIJgS (ORCPT ); Mon, 9 Oct 2023 05:36:18 -0400 Received: from mail-qk1-x72a.google.com (mail-qk1-x72a.google.com [IPv6:2607:f8b0:4864:20::72a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBE97101 for ; Mon, 9 Oct 2023 02:36:15 -0700 (PDT) Received: by mail-qk1-x72a.google.com with SMTP id af79cd13be357-77409065623so246972685a.0 for ; Mon, 09 Oct 2023 02:36:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696844175; x=1697448975; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=NbPQn5PYDTYWmHehcflWH6rr2b2zYJNRYM1EffH3dP8=; b=q+zQqYGHKC3VdKkSBxfAKFApTLXq+oKJxK6lXPVPlQmk877rKcPXXoNSP0uCCbw3aH kDKgEsptNC4JuJlwHwkZ4LXgbF60inltIh40ilxDtTwVnpQHff+gIlEggYFi1Z7SyJjQ O+U7UjEsOVbA/IaLWCcNTtWT9/2NvuIMScCC2qWfiBul3WiNgDP96ZaZCMaPluAGFQuZ nBlffRcutdlzbsvFQ2r7xg3NGG9YRjHZpAJg5mnpXY+VwWbxpphtNwyVbKfq8zp+0s1A oUhlnna1+TRBryGhR0DOex19FpMZgY+cQOhbl2zpMzB3d9+L+FbSNgvaYO/uYD9OxaRY NLeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696844175; x=1697448975; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NbPQn5PYDTYWmHehcflWH6rr2b2zYJNRYM1EffH3dP8=; b=Xhd4tpyfgr926XKThiNJnb+2Blh/jCQ//rD+KBHju5hlZQrzLXsy8oqr4M8Tt7Avun b3epYzStbosQzmmiDTM8lORNEeNuZ0vxrm71Ml6KDnxpLxKJiyUy8ru8ffnR/J2Ea/Cf SI9AzyOHfiL/VGztWiMzE6EnXGmqXkrs3mX9qoH1NQCpMx9hARz+Galv5tVoIRkNzq64 1XgfBlrdVcCr21mDy9cXjV2hXWbkj6UsXwuvcHO5HWgVT2dG3urXg0H61pZSmurh3NDX Nij5LXEt3bi/JW3G5S92TtXgjTIAiPO0ChzafhIXY7iVBYhHrxLElEbtVSTvxpBpfHaR U0Aw== X-Gm-Message-State: AOJu0Ywx5aaT6N0t7DnV8dGqPCq3laz3/FVsfdlL1Xxj/kl4YdEi/kgB kNotB/sSXw4ECHoMmV37wiv9EE4fhJehcloOi5qB5g== X-Received: by 2002:ad4:5d6a:0:b0:65a:f5e9:8ecf with SMTP id fn10-20020ad45d6a000000b0065af5e98ecfmr19993574qvb.60.1696844174006; Mon, 09 Oct 2023 02:36:14 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Alexander Potapenko Date: Mon, 9 Oct 2023 11:35:38 +0200 Message-ID: Subject: Re: [PATCH v2 07/19] lib/stackdepot: rework helpers for depot_alloc_stack To: andrey.konovalov@linux.dev Cc: Marco Elver , Andrey Konovalov , Dmitry Vyukov , Vlastimil Babka , kasan-dev@googlegroups.com, Evgenii Stepanov , Oscar Salvador , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.8 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Mon, 09 Oct 2023 02:36:27 -0700 (PDT) On Mon, Oct 9, 2023 at 10:59=E2=80=AFAM Alexander Potapenko wrote: > > On Wed, Sep 13, 2023 at 7:15=E2=80=AFPM wrot= e: > > > > From: Andrey Konovalov > > > > Split code in depot_alloc_stack and depot_init_pool into 3 functions: > > > > 1. depot_keep_next_pool that keeps preallocated memory for the next poo= l > > if required. > > > > 2. depot_update_pools that moves on to the next pool if there's no spac= e > > left in the current pool, uses preallocated memory for the new curre= nt > > pool if required, and calls depot_keep_next_pool otherwise. > > > > 3. depot_alloc_stack that calls depot_update_pools and then allocates > > a stack record as before. > > > > This makes it somewhat easier to follow the logic of depot_alloc_stack > > and also serves as a preparation for implementing the eviction of stack > > records from the stack depot. > > > > Signed-off-by: Andrey Konovalov > Reviewed-by: Alexander Potapenko > > > > +static void depot_keep_next_pool(void **prealloc) > > { > > /* > > - * If the next pool is already initialized or the maximum numbe= r of > > + * If the next pool is already saved or the maximum number of > > * pools is reached, do not use the preallocated memory. > > */ > > if (!next_pool_required) > It's not mentioned at the top of the file that next_pool_required is > protected by pool_lock, but it is, correct? > Can you please update the comment to reflect that? You're adding lockdep annotations in patch 11, which are pretty self-descriptive. Feel free to ignore my comment above.