From patchwork Tue Sep 21 10:10:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Elver X-Patchwork-Id: 12507489 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=-26.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_AGENT_GIT,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 AB978C433EF for ; Tue, 21 Sep 2021 10:10:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5FC0560F9D for ; Tue, 21 Sep 2021 10:10:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5FC0560F9D 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 E64016B0075; Tue, 21 Sep 2021 06:10:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DEC6C6B0078; Tue, 21 Sep 2021 06:10:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C657B900002; Tue, 21 Sep 2021 06:10:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id AA0FA6B0075 for ; Tue, 21 Sep 2021 06:10:32 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 6B482235BF for ; Tue, 21 Sep 2021 10:10:32 +0000 (UTC) X-FDA: 78611161104.19.FDB23F0 Received: from mail-wr1-f73.google.com (mail-wr1-f73.google.com [209.85.221.73]) by imf11.hostedemail.com (Postfix) with ESMTP id 2C9E6F0000BE for ; Tue, 21 Sep 2021 10:10:32 +0000 (UTC) Received: by mail-wr1-f73.google.com with SMTP id i4-20020a5d5224000000b0015b14db14deso8371910wra.23 for ; Tue, 21 Sep 2021 03:10:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=+aOzJl+IOHEzliD/59W8D7vvkFuM5qZHbYDQFSYPXT0=; b=aFGoLLrFkaG1Jv4QLHaJkF6I3uEoq4A5AJzdm69l+j3q/5szCUvpqk9ZBSpifegZh7 7mIN1MOkeF95mNesAfw2+ILFm7i3Kt9YsMHs5CI0eED0o5koHyQnW6Uq9U0f1iH9johY mvSiUClnJeCiqROBHKO51gLbqDHgUYsrqn2TmtZEuNckaKHqkdMD85zsmEVrAT8aASQU eUHxu0Qp8wOoFHuNFe2UyGkFC/qUwXTeerJNNKW/c+P+uzILzp4NrET0Ozjz5L73lFG6 BXfwgGS9ZVeotQ1x1+5LnibZ0TmWgtFQvB/s5jMaYE8qH50/tMfYBpeqMXmb7jf960FS 8VTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=+aOzJl+IOHEzliD/59W8D7vvkFuM5qZHbYDQFSYPXT0=; b=gK33UyFrzdFlT8azr2BGWEMZGBZ5pN8bsKXuLgG0SJQv0+SJ8rbjO0ma8trW5BxnBg oxkOmkWvei69fDxAUSiRmeS9+ZpuWXRsjQxUB2QsFLlAceN1N1ItY1hsM9jqdWJgX86O lv00HtCrt+aROgUuZLttKP1vX0QWu8y8t5pDPK2gDLJiai6WpCwL6uwRZb/IMqXZZVXv 0MePbBP42e1sYKdHyfUtKK5pW7Z3KBR3boI5eerAcyA8CARY8cRCEEr7KSRMOGiZhMyN yU4di9Zrxc02Y4CZic7C9ll97M1SdmXNrYOIwifOlDIyLMqZ+E4hF73/fLsFve24Yvuj go/A== X-Gm-Message-State: AOAM531wJzrTuMlOs+pUnwBz+L5gUihFJD4LPRE9WLP562THlUtcyCIr F8rPKgkp32qEI+hLAiNKPtuRUVU1zQ== X-Google-Smtp-Source: ABdhPJys3pVww4ZkhI5lNJvpGxC7FpDSW8fdyC3vE/S9sO05lABxATNp5/Fu8r8Y8OsHyFWVo/Rz/kH4aw== X-Received: from elver.muc.corp.google.com ([2a00:79e0:15:13:dd03:c280:4625:60db]) (user=elver job=sendgmr) by 2002:adf:ea90:: with SMTP id s16mr34027049wrm.235.1632219031088; Tue, 21 Sep 2021 03:10:31 -0700 (PDT) Date: Tue, 21 Sep 2021 12:10:14 +0200 In-Reply-To: <20210921101014.1938382-1-elver@google.com> Message-Id: <20210921101014.1938382-5-elver@google.com> Mime-Version: 1.0 References: <20210921101014.1938382-1-elver@google.com> X-Mailer: git-send-email 2.33.0.464.g1972c5931b-goog Subject: [PATCH v2 5/5] kfence: add note to documentation about skipping covered allocations From: Marco Elver To: elver@google.com, Andrew Morton Cc: Alexander Potapenko , Dmitry Vyukov , Jann Horn , Aleksandr Nogikh , Taras Madan , linux-kernel@vger.kernel.org, linux-mm@kvack.org, kasan-dev@googlegroups.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 2C9E6F0000BE X-Stat-Signature: e1z87aaz7idteeqtt4f5t8j4im3bnm1a Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=aFGoLLrF; spf=pass (imf11.hostedemail.com: domain of 3l69JYQUKCC4OVfObQYYQVO.MYWVSXeh-WWUfKMU.YbQ@flex--elver.bounces.google.com designates 209.85.221.73 as permitted sender) smtp.mailfrom=3l69JYQUKCC4OVfObQYYQVO.MYWVSXeh-WWUfKMU.YbQ@flex--elver.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com X-HE-Tag: 1632219032-727506 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: 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 ---------