Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp32925pxm; Wed, 2 Mar 2022 09:53:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJwYxxi4/Vcl6vJCu+n0aR6SDOFgijpj/rnYVCv2kBlUeFqlAtp15d1zq6l1dZGZC1OlcKxa X-Received: by 2002:a17:90b:1e4b:b0:1bc:4d46:55a7 with SMTP id pi11-20020a17090b1e4b00b001bc4d4655a7mr946944pjb.151.1646243600255; Wed, 02 Mar 2022 09:53:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646243600; cv=none; d=google.com; s=arc-20160816; b=rbudXquBojjbZAgweV7f/qZCZ/8MYo6ojg6iaLZYQPcP8yxnYv2fjxxkONd96FLGbW GycznVmclUMbTxewovoIEQImgaOJji+vyioifSe7lmEawetnvA5BVNeKBba7ynUHhGqO QAd57PhqPPkiHYPBIJGggPC9Y+ptMEWzPwEK/PJRnH+tsmQO7PUsA86wAM3aNhYKfGXR fqpop+TEXQ9kb7hhIBjjIWFGS9KxPflik0Lcr7EUCxV303TGhfCDQDXSwJVMvHuDm8xj gcE9WkZo9Dx8XAJFmvrDOELpEjeLfKzVwmfVgWEEQL025JldyC1SJLP1teKZKG5EhzXC 1dAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Uuao6LtPoxz+SwUeDa6xzf7SfiyP8QP18hPPHG47BUc=; b=i8PxmH/XchlTXtfpqpHAjpk94y0qCLscyXtppAde82HeQMSrlwZkebgjYKoIz3e+b3 4tGGk/j2w7bdSvRW/nC3Q4Hjldc23r7cmv7c1Q0ZGwq/6AKp862Tf5B7fbREAvz0XcBL v3eQE6DKDfEElaVS3Bif45ijl2qftw3DVWDlLsdH3rFedjoIQSB7rdGs2CbYAr5Eaa8F qGR14KwVROjlTGxzYMD1uTR7f6eVTG2hn3rD0/6svjkjjG51Dp4jWMAR1Tn1zRZuNIbe tW+3GR0WPIVj2A2Xvxwanphg1fdBU1RrlNAF9VPoBNZhwyPpsC/X733Z5d89gJR8pBZp JDBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=q3XRXLhS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l11-20020a056a00140b00b004f3a81da9a5si16493548pfu.234.2022.03.02.09.53.03; Wed, 02 Mar 2022 09:53:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=q3XRXLhS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243907AbiCBR3q (ORCPT + 99 others); Wed, 2 Mar 2022 12:29:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239351AbiCBR3k (ORCPT ); Wed, 2 Mar 2022 12:29:40 -0500 Received: from mail-yw1-x112c.google.com (mail-yw1-x112c.google.com [IPv6:2607:f8b0:4864:20::112c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 785A24D601 for ; Wed, 2 Mar 2022 09:28:08 -0800 (PST) Received: by mail-yw1-x112c.google.com with SMTP id 00721157ae682-2dbfe58670cso26331747b3.3 for ; Wed, 02 Mar 2022 09:28:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Uuao6LtPoxz+SwUeDa6xzf7SfiyP8QP18hPPHG47BUc=; b=q3XRXLhSkdzfXMPqmPGrtL5qKLDaaanmRsuY1OlB+gywhyfQ3P0k2Ty/lLBIx9hngr bIE3qAL4ikUxI5IPrvBeSteXA23/TUiOhOXlNzpa2gQtUgeyGl8Sv+On2Q2+b/ioPLVK y6mGgX6AYdM5qc4LpFsHD+JseMxCAPR3H5Cc4VnjOZ7eV1ADHbYrVBbr9AL8ZR5ElxMn onL1EgPo/RmTTVYw9otAeEqlQaXOudGa8wKxOcCtR9oLm0BoPskgY4WBR6I9166lo/cT W+PbTD8Xdk6xgUjKZon509MUJZNIphLafkMUrZ8a/ku3GC4bjTQpoQ7Ua0dreHWIDPif i76A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Uuao6LtPoxz+SwUeDa6xzf7SfiyP8QP18hPPHG47BUc=; b=q7SzyoTCNiEKiH4Dv7j9enkZOK+cpRjE0vK8rrygf3b/VkhmIfb7160pojBK8jd8Fr lk2p0cpOO/7jr66U35OaoiJI9x8qQU67mYcneNojhtS4t8rWjjp9QR7YvUjdcm5/k4Kd 0kc5EK9Y3VUDT0wRE81/ELSZ2HwdUkWq7jjgydhKfHAnzBGrOIwKQaPb8PZZbN6OJ/GS ZHMa1Z3q3SJ6C0VbYwbKqOD4ekj6r05ej+Fy5nUXqZI7Kto3+0v7Qa8RH+fOAUocUt/o zKE9Y0gmxy5Zd17ia8H2udlZq9mqw6NNcS88HOblOSjyqaGOmcwlnQ5V27k9cuveSh0T Mr4Q== X-Gm-Message-State: AOAM530Rm3CniJZzq7fHjk9ONNk3OH926qTZrdRo8fDNMQmQNgPwlOXd kcCOpgfRJkHmwwITscYxQPRhQixw+3hfwErFkIi64Q== X-Received: by 2002:a81:49d0:0:b0:2db:dc6d:445d with SMTP id w199-20020a8149d0000000b002dbdc6d445dmr9596217ywa.512.1646242087255; Wed, 02 Mar 2022 09:28:07 -0800 (PST) MIME-Version: 1.0 References: <20220225180318.20594-1-vbabka@suse.cz> <024aacf5-ac49-7d04-7293-1e1451ff9029@suse.cz> In-Reply-To: From: Marco Elver Date: Wed, 2 Mar 2022 18:27:30 +0100 Message-ID: Subject: Re: [PATCH 0/5] SLUB debugfs improvements based on stackdepot To: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: Mike Rapoport , Vlastimil Babka , David Rientjes , Christoph Lameter , Joonsoo Kim , Pekka Enberg , Roman Gushchin , Andrew Morton , linux-mm@kvack.org, patches@lists.linux.dev, linux-kernel@vger.kernel.org, Oliver Glitta , Faiyaz Mohammed , Jonathan Corbet , Randy Dunlap , Karolina Drobnik Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-18.1 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2 Mar 2022 at 18:02, Hyeonggon Yoo <42.hyeyoo@gmail.com> wrote: [...] > So IMO we have two solutions. > > First solution is only allowing early init and avoiding late init. > (setting a global variable that is visible to stack depot would do this) > > And second solution is to make caller allocate and manage its own hash > table. All of this complexity is because we're trying to make stack_table > global. I think this would be a mistake, because then we have to continuously audit all users of stackdepot and make sure that allocation stack traces don't end up in duplicate hash tables. It's global for a reason. > First solution looks ok if we have few users of stack depot. > But I think we should use second approach if stack depot is growing > more and more callers? The problem here really is just that initialization of stackdepot and slabs can have a cyclic dependency with the changes you're making. I very much doubt there'll be other cases (beyond the allocator itself used by stackdepot) which can introduce such a cyclic dependency. The easiest way to break the cyclic dependency is to initialize stackdepot earlier, assuming it can be determined it is required (in this case it can because the command line is parsed before slab creation). The suggestion with the stack_depot_needed_early variable (like Mike's suggested code) would solve all that. I don't understand the concern about multiple contexts. The problem is just about a cyclic dependency during early init, and I doubt we'll have more of that. Thanks, -- Marco