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=-23.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL autolearn=ham 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 A83FCC433EF for ; Tue, 21 Sep 2021 10:51:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 357D860F50 for ; Tue, 21 Sep 2021 10:51:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 357D860F50 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 CA9F4900006; Tue, 21 Sep 2021 06:51:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C59C1900002; Tue, 21 Sep 2021 06:51:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B21CF900006; Tue, 21 Sep 2021 06:51:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0221.hostedemail.com [216.40.44.221]) by kanga.kvack.org (Postfix) with ESMTP id A331A900002 for ; Tue, 21 Sep 2021 06:51:33 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 5D7432BFB4 for ; Tue, 21 Sep 2021 10:51:33 +0000 (UTC) X-FDA: 78611264466.18.459B9FF Received: from mail-oi1-f171.google.com (mail-oi1-f171.google.com [209.85.167.171]) by imf26.hostedemail.com (Postfix) with ESMTP id 21FB920019C3 for ; Tue, 21 Sep 2021 10:51:32 +0000 (UTC) Received: by mail-oi1-f171.google.com with SMTP id v10so11908092oic.12 for ; Tue, 21 Sep 2021 03:51:32 -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=N8im2OS98fNlJW2Ij6zQsDpm5TLK4cuMawMCjuGiTZU=; b=RR3cWHZ7Pw8yzusQe/R4SgSdvdSokVrUN1ScMzm8Low2Rp9NdUT/hMEzxFMF2nyhoD MZzrjwBiFKM9KDWtQ2ca6aNVcuzWC3B+Div+rkPUelnOGhf6sF2ltiY1VS1YQkCAY/O6 7hAzDV9UBpTMR3HWey0UrUsOsvWpsP8hyQ3FmznVziVH9+4hLqPwKxZMHHQu+80rQn0R eMjzGCNby8+kvvir55KtM/RdBpgwdVycCcPLQfxb8u8T7gI1n3cc81239/YY8lWDSZlk dAkiGsYiBTgKVF/XSqcKaI7ON9208ReerBrU6IZ4Qsb0G6Lepw7yaX/GFs6noreOq8ym +1wA== 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=N8im2OS98fNlJW2Ij6zQsDpm5TLK4cuMawMCjuGiTZU=; b=Na0Mg7ime3Q6W8Mox+/eOeFSC7CYJEAl6a2iD/U9sEYByeMP7I7FX2hmUlEEGt5k9G 7Af+91NpyILxt/ZhjzPXxtASzq9RyRdXsrVKI05uNkWypWA/R6igX65R6O8TU2WV5iVs Y8ujstjClYDHU5xxKW+Xio/LK6wOUtWxfJLU+/l7qEQIP0YB1GY8DouNmExT8HgLge9J /N71tvSoCA5GwDy/SURSspBk0MWOx38kka9C+R9rBrqsnDGItwq+m68eD9S+0JIJTY1O c7E9E/cYRZqqPITnJkDSNKt9H9epPqZoh69vmEPUtaD2u+lv8+zaSF/NGPthNjDkWA4p Jv0g== X-Gm-Message-State: AOAM530/6W8A35sPOLxflNOtzPaVUJUEpqFNevm9Q3W/otDsLFG/ZOsT 7F8BGpwcV/U4bPB+hFOtb3VNA+2Xt/GQTDEHe+2QSQ== X-Google-Smtp-Source: ABdhPJzHhMZvBpunQ9yksrBPafO+qk6Wq8WAzorP2+VXo94nhZjFWf2ZcLqY+NbwApLV7gcHfWQ6J0SIkkglMBmVT7Q= X-Received: by 2002:aca:3083:: with SMTP id w125mr3028189oiw.109.1632221492218; Tue, 21 Sep 2021 03:51:32 -0700 (PDT) MIME-Version: 1.0 References: <20210921101014.1938382-1-elver@google.com> <20210921101014.1938382-5-elver@google.com> In-Reply-To: <20210921101014.1938382-5-elver@google.com> From: Dmitry Vyukov Date: Tue, 21 Sep 2021 12:51:21 +0200 Message-ID: Subject: Re: [PATCH v2 5/5] kfence: add note to documentation about skipping covered allocations To: Marco Elver 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: i9hz1puxm3gr63kq9kf3w84r3ttbxzun Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=RR3cWHZ7; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf26.hostedemail.com: domain of dvyukov@google.com designates 209.85.167.171 as permitted sender) smtp.mailfrom=dvyukov@google.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 21FB920019C3 X-HE-Tag: 1632221492-144650 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, 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 12:10, Marco Elver wrote: > > Add a note briefly mentioning the new policy about "skipping currently > covered allocations if pool close to full." Since this has a notable > impact on KFENCE's bug-detection ability on systems with large uptimes, > it is worth pointing out the feature. > > Signed-off-by: Marco Elver Reviewed-by: Dmitry Vyukov > --- > v2: > * Rewrite. > --- > Documentation/dev-tools/kfence.rst | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/Documentation/dev-tools/kfence.rst b/Documentation/dev-tools/kfence.rst > index 0fbe3308bf37..d45f952986ae 100644 > --- a/Documentation/dev-tools/kfence.rst > +++ b/Documentation/dev-tools/kfence.rst > @@ -269,6 +269,17 @@ tail of KFENCE's freelist, so that the least recently freed objects are reused > first, and the chances of detecting use-after-frees of recently freed objects > is increased. > > +If pool utilization reaches 75% (default) or above, to reduce the risk of the > +pool eventually being fully occupied by allocated objects yet ensure diverse > +coverage of allocations, KFENCE limits currently covered allocations of the > +same source from further filling up the pool. The "source" of an allocation is > +based on its partial allocation stack trace. A side-effect is that this also > +limits frequent long-lived allocations (e.g. pagecache) of the same source > +filling up the pool permanently, which is the most common risk for the pool > +becoming full and the sampled allocation rate dropping to zero. The threshold > +at which to start limiting currently covered allocations can be configured via > +the boot parameter ``kfence.skip_covered_thresh`` (pool usage%). > + > Interface > --------- > > -- > 2.33.0.464.g1972c5931b-goog >