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 X-Spam-Level: X-Spam-Status: No, score=-13.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D938C433EF for ; Tue, 21 Sep 2021 11:35:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D955361166 for ; Tue, 21 Sep 2021 11:35:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D955361166 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 7445394000F; Tue, 21 Sep 2021 07:35:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6F3D8940009; Tue, 21 Sep 2021 07:35:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5C78494000F; Tue, 21 Sep 2021 07:35:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0252.hostedemail.com [216.40.44.252]) by kanga.kvack.org (Postfix) with ESMTP id 4D400940009 for ; Tue, 21 Sep 2021 07:35:56 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 07D13180ACF16 for ; Tue, 21 Sep 2021 11:35:56 +0000 (UTC) X-FDA: 78611376312.23.50C24B4 Received: from mail-oi1-f182.google.com (mail-oi1-f182.google.com [209.85.167.182]) by imf25.hostedemail.com (Postfix) with ESMTP id B6756B00008E for ; Tue, 21 Sep 2021 11:35:55 +0000 (UTC) Received: by mail-oi1-f182.google.com with SMTP id y201so14501826oie.3 for ; Tue, 21 Sep 2021 04:35:55 -0700 (PDT) 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=y/NtL1eqdessLJJ7QAgmdSlgwRQ9C8fMojdqN92nFPU=; b=RcIeDxNz16hCkRCahO6aJoeYtQN4Ebe55P/m5406fDQxt64VMzUraHbWyBqK/6ufh4 BNdPjU8lfKcmJV8oAdZqN4DyfcEBHJcdKHltk3Puk7isGHcBiWWKrbjuAzKfzxEMkf6z WK+CiSzWw0lkE7oMDxdZqr/xcGDbh66EE5ONRlrQCS6gqjLdEzgfeo6wBxMbyB31Z6yE wk6vUIoajrv7uHtvEzlRlCYoSCMbfzEC0cWLVF1ntmleky3Dz8fNFFSpHiHyeX02womR IzpCdjeT+ZlvQ9V0+WnPv6vHkSSd0gn8w3PlY3UTIqiviaOOly4K8xBNJYN5xhpND6Kh MFYQ== 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=y/NtL1eqdessLJJ7QAgmdSlgwRQ9C8fMojdqN92nFPU=; b=adheOfYBE9VTkMv7xP3GCivsX2x1JfJGMq9I+V+XgO639T0s80slyK+OoN8SSAidJm KoWJiVNM51y5pP9andwoF8evjXsoUGEl77erGLTAyK9cHcY/yP6/6/TruKoyZ8J3GzlT wZ0vk8JCBKt3ZhT4Wrm5dI8ruUY3fgf0fCiZNcuJgFq3T31dBXnNJdsvI/UOWTArvjFi q+LbMoJF02BI1w1ZrQwgt9Xv0iuWZa7mBVSDeJvXfaM3EYs3Ufp+LpKrQP2kEp146txW LkzSqsixuSmM3cxEUpdECOHP4+uemthKMVGVpOx2T+N2hDdbn9A1uYMFWyJR6Kra/HfW EFFg== X-Gm-Message-State: AOAM532bgjqraLz6dovC4CzUfhEHgTH6sBjCG7J3MkSqK8GUVuLXB5G0 UA4vUYDZqTJ/pptxie6qJzHgFrBmuei1krOI1cInDg== X-Google-Smtp-Source: ABdhPJzC6ci1Dmx4ZzdOTG1OUQaNGftnP651SqaVwyJyYzS8AAG/+opo9hgOGWhtcljKstsEHUdVRsqjXvqiknzrXVw= X-Received: by 2002:aca:4344:: with SMTP id q65mr3351129oia.70.1632224154781; Tue, 21 Sep 2021 04:35:54 -0700 (PDT) MIME-Version: 1.0 References: <20210921101014.1938382-1-elver@google.com> <20210921101014.1938382-4-elver@google.com> In-Reply-To: From: Marco Elver Date: Tue, 21 Sep 2021 13:35:42 +0200 Message-ID: Subject: Re: [PATCH v2 4/5] kfence: limit currently covered allocations when pool nearly full To: Dmitry Vyukov Cc: Andrew Morton , Alexander Potapenko , Jann Horn , Aleksandr Nogikh , Taras Madan , linux-kernel@vger.kernel.org, linux-mm@kvack.org, kasan-dev@googlegroups.com Content-Type: text/plain; charset="UTF-8" X-Stat-Signature: bxsfffbt978mbisf1qxjd9ydyzbyosio Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=RcIeDxNz; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf25.hostedemail.com: domain of elver@google.com designates 209.85.167.182 as permitted sender) smtp.mailfrom=elver@google.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: B6756B00008E X-HE-Tag: 1632224155-735013 X-Bogosity: Ham, tests=bogofilter, spamicity=0.003812, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, 21 Sept 2021 at 13:05, Dmitry Vyukov wrote: [...] > > +/* > > + * Adds (or subtracts) count @val for allocation stack trace hash > > + * @alloc_stack_hash from Counting Bloom filter. > > + */ > > +static void alloc_covered_add(u32 alloc_stack_hash, int val) > > +{ > > + int i; > > + > > + if (!alloc_stack_hash) > > + return; > > Nice! > I like the hash seed, non-evicting cache and that threshold become a > command line parameter. > > This check is the only place I don't understand. What's special about > alloc_stack_hash == 0? I see that even double-free's won't call this > with 0. Indeed, it's no longer required (I think it was in a previous version I played with). At this point, it should only be true if jhash() returns 0 for something, and in that case might not even want the check. I can also remove the unnecessary "meta->alloc_stack_hash = 0;" in kfence_guarded_free(). Unless I hear otherwise, I'll remove the unneeded code (and send a v3 of this series in a few days).