Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp601852rwr; Fri, 5 May 2023 02:01:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7J2X4tQi8cfF0CCdxwQZhnZ+50Fk3xhochwhcZUD6bNViUdVQcowVJm+C7liljXqCxNDvL X-Received: by 2002:a17:90a:380f:b0:24e:ab82:aac5 with SMTP id w15-20020a17090a380f00b0024eab82aac5mr5998573pjb.5.1683277289920; Fri, 05 May 2023 02:01:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683277289; cv=none; d=google.com; s=arc-20160816; b=RjBX8IaKd8Ja/BOXlpKR2ApwUzo/+5aPeE8zL0YMua9L5ANKMrn1I7zI+W+kpVd8yB 26Q5S6BCGkkZi4jJVhg9gPknuAGPBromW97m8SQNtr/CHb2YPZSZMtDTQYnR79eSFxzj aYveM6Tl8p441F4Cay7NCKyErIKB8vICY6Lz84nyMp3XL4/UQsOaowtBb4zNPF+Z1dFg qreUDLZOegXsuxg8VZhSWBwY4ZamHjPuJUNbw8180S1wjdzD7iut6N+eGOSuLsGx3g0F ukVPA4cjdcEC0eTqP3tBBogNZXslIVUdS5IUYWi/likIfW4YYudJF0JaNAYe8UgQNJP1 c/Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=/0NvfINDngaX81zK/8XuAzfIOyZoSgVhu9auLhp95+8=; b=GnKc9P49y4+0hcnostx8RZwiKgKLsVRKIDDD20KKWRl0b9DvOhY+7XElEiwZ5HtDjV yRud4JZz830GKgapLAC2lGLg9LJ/RK421tr82XiAskCr+dY0b1DYGOHI+9ph6g6HQ1U/ UoK7uWshVKO0cMBUnKiPO617VfWTzisKWnAWLVz48cdatUfM3KbtxFJlVIW/sFsYgFt+ XFyT9VELEdyWUXK1Fe/UrmPLgxgU0BZag4kolN3HAnP8A5B4gpfjshZaToz3gemHKhgK sWZAfWCGDzGfnLY/DTURXR/YN9unYaxG4UWnbdrPI7u73T/jFXvkzz2p30saRoTYBmM9 oNjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=N7Hh14Vs; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m13-20020a637d4d000000b0050bf5a814a8si1537768pgn.403.2023.05.05.02.01.12; Fri, 05 May 2023 02:01:29 -0700 (PDT) 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=@suse.com header.s=susede1 header.b=N7Hh14Vs; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231540AbjEEIkb (ORCPT + 99 others); Fri, 5 May 2023 04:40:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231490AbjEEIkX (ORCPT ); Fri, 5 May 2023 04:40:23 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F44E18868; Fri, 5 May 2023 01:40:21 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id DC8F022A20; Fri, 5 May 2023 08:40:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1683276019; h=from:from:reply-to: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=/0NvfINDngaX81zK/8XuAzfIOyZoSgVhu9auLhp95+8=; b=N7Hh14VsXyzhdip98WZKHL6vi++Ot45f7xe1XG1LXAkD8DEJNNJwpr4HSGIxEz/MZq1bfG KUwErWXXaSTBD69btoSMDYsSKukSj3gDTrJzJv4JPQtavr86N6hSjezAAulivmJwR+mrLN xGzDPAbAKNp+pIZ7BzXA3dFlbRMDVYo= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id AB98313488; Fri, 5 May 2023 08:40:19 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id VIvmKfPAVGSkQwAAMHmgww (envelope-from ); Fri, 05 May 2023 08:40:19 +0000 Date: Fri, 5 May 2023 10:40:19 +0200 From: Michal Hocko To: Suren Baghdasaryan Cc: akpm@linux-foundation.org, kent.overstreet@linux.dev, vbabka@suse.cz, hannes@cmpxchg.org, roman.gushchin@linux.dev, mgorman@suse.de, dave@stgolabs.net, willy@infradead.org, liam.howlett@oracle.com, corbet@lwn.net, void@manifault.com, peterz@infradead.org, juri.lelli@redhat.com, ldufour@linux.ibm.com, catalin.marinas@arm.com, will@kernel.org, arnd@arndb.de, tglx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, x86@kernel.org, peterx@redhat.com, david@redhat.com, axboe@kernel.dk, mcgrof@kernel.org, masahiroy@kernel.org, nathan@kernel.org, dennis@kernel.org, tj@kernel.org, muchun.song@linux.dev, rppt@kernel.org, paulmck@kernel.org, pasha.tatashin@soleen.com, yosryahmed@google.com, yuzhao@google.com, dhowells@redhat.com, hughd@google.com, andreyknvl@gmail.com, keescook@chromium.org, ndesaulniers@google.com, gregkh@linuxfoundation.org, ebiggers@google.com, ytcoode@gmail.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, bristot@redhat.com, vschneid@redhat.com, cl@linux.com, penberg@kernel.org, iamjoonsoo.kim@lge.com, 42.hyeyoo@gmail.com, glider@google.com, elver@google.com, dvyukov@google.com, shakeelb@google.com, songmuchun@bytedance.com, jbaron@akamai.com, rientjes@google.com, minchan@google.com, kaleshsingh@google.com, kernel-team@android.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, linux-arch@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-modules@vger.kernel.org, kasan-dev@googlegroups.com, cgroups@vger.kernel.org Subject: Re: [PATCH 35/40] lib: implement context capture support for tagged allocations Message-ID: References: <20230501165450.15352-1-surenb@google.com> <20230501165450.15352-36-surenb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Thu 04-05-23 09:22:07, Suren Baghdasaryan wrote: [...] > > But even then I really detest an additional allocation from this context > > for every single allocation request. There GFP_NOWAIT allocation for > > steckdepot but that is at least cached and generally not allocating. > > This will allocate for every single allocation. > > A small correction here. alloc_tag_create_ctx() is used only for > allocations which we requested to capture the context. So, this last > sentence is true for allocations we specifically marked to capture the > context, not in general. Ohh, right. I have misunderstood that part. Slightly better, still potentially a scalability issue because hard to debug memory leaks usually use a generic caches (for kmalloc). So this might be still a lot of objects to track. > > There must be a better way. > > Yeah, agree, it would be good to avoid allocations in this path. Any > specific ideas on how to improve this? Pooling/caching perhaps? I > think kmem_cache does some of that already but maybe something else? The best I can come up with is a preallocated hash table to store references to stack depots with some additional data associated. The memory overhead could be still quite big but the hash tables could be resized lazily. -- Michal Hocko SUSE Labs