Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2643666pxb; Tue, 21 Sep 2021 04:40:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLSjz3BWQHj9hpV7w1Kj+4s4DrlL2jkVaNER0Rfb4k3pLELOocQspXY11qnmiRcFXO3o0E X-Received: by 2002:a05:6402:168b:: with SMTP id a11mr35268663edv.295.1632224455531; Tue, 21 Sep 2021 04:40:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632224455; cv=none; d=google.com; s=arc-20160816; b=M5r7Yj9nqnS9jo5YHo30EZobuvmGcGk8VfK116aeectu10fSkpDQlsK/21zt1TZ77H 38OTv8570XARJkaLy2D/Jr2/L+EFdXyTeReocybNY+dtx2v2O4VOdcbe2OHWssBPsTzU PNFJBG1yo1P9ORBoEH0uoLC8brc75be7eeC4/Wd9qLAW9suB18BEw1d4C3h9YmxPLt61 0mcPS0850I0DI6bf/fGrDbjX3ZKp9gMFoP8XxBMCFfEWCcJHZ1NL4CA0Hh197ITZsVgI /XuY/aEGBk1s6FfMJXs1R9rFZ4xcYNuBzAqfo0rX/I8Y77Ikm6lacArrlCpz/MvmZJtI GipA== 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=y/NtL1eqdessLJJ7QAgmdSlgwRQ9C8fMojdqN92nFPU=; b=ssrrwdjJYFYbdJQmqTud6Gw+NarDnIT095X7Y8ZA6A4x32W4tbGSlmetv5sSMjV7jN Kc+MUsEeRGicMg+n7rLUpyVh9qC17RijSKhCM0TJztykc28nxR56JxGUOnUYvOBEFUY1 pz22eF0a/4h3ICTZXlM+E1Aqs+rVOP3aSrCl8NlI199Fto3cSGCP4ysEpNUG3Hn/MfB2 Oa0BY2gF0D15zuLp//f13QL9y1hbWFCRmmO8flXtjsF3hfXGFBatk0/yfSa6I6D+u1Zy jchmeJdZmxKbFhMY1Z99PeZecgQPrItR0KzrsagWZ2wZMDIIaJlxBuDgAoJvWNd79wFq +ScQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=RcIeDxNz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n5si15316487ejl.433.2021.09.21.04.40.24; Tue, 21 Sep 2021 04:40:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=RcIeDxNz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S232456AbhIULhY (ORCPT + 99 others); Tue, 21 Sep 2021 07:37:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232208AbhIULhX (ORCPT ); Tue, 21 Sep 2021 07:37:23 -0400 Received: from mail-oi1-x234.google.com (mail-oi1-x234.google.com [IPv6:2607:f8b0:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABF57C061574 for ; Tue, 21 Sep 2021 04:35:55 -0700 (PDT) Received: by mail-oi1-x234.google.com with SMTP id x124so5635518oix.9 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=BcDupYbiiDnvcke9razJwUx2IFbdx4nOcz/hBinzPJISoAyg185O2tmGZ96OBAinxo YXRUO3mAbtEKkOfcYhZcSX5o4OlL1F70nDieow/LgYJ6sb+zEVOkZQvcswGqvZk7/Dam fg7tcPVZuPASnLEGEpEIfiKzVcVSMDcqEG56HGNWlIuh6tIrDudDZiPbOWbxdLrBwga5 jSKXgZ72gdZQeW84M2+6ZbmNDfjd+BkY0N5lluz4Fk5tPlClHGADX4X6Y4C/oJSN/G1V +wwQrTJi9a1S+ba8gCZ/mIZp4cb+Xz8BCNNgYbvdp7vdXSC1WVW/PPRuqGn66XQuGMgv 7eNw== X-Gm-Message-State: AOAM533yR2Avyecz/KLmy655dzzCHjZhBTc2CRbdYfPbALqYqGq1Ib9c +h4porABp9rVKh71yceT+rgxvkhrzgHDit+hE0RCyg== 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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).