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=-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=unavailable 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 9859AC433EF for ; Thu, 23 Sep 2021 10:48:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7D7EB60EE7 for ; Thu, 23 Sep 2021 10:48:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240495AbhIWKt5 (ORCPT ); Thu, 23 Sep 2021 06:49:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240476AbhIWKtx (ORCPT ); Thu, 23 Sep 2021 06:49:53 -0400 Received: from mail-qv1-xf4a.google.com (mail-qv1-xf4a.google.com [IPv6:2607:f8b0:4864:20::f4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8A64C061574 for ; Thu, 23 Sep 2021 03:48:21 -0700 (PDT) Received: by mail-qv1-xf4a.google.com with SMTP id e6-20020a0cb446000000b0037eeb9851dfso18984540qvf.17 for ; Thu, 23 Sep 2021 03:48:21 -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=sS022PP0nBNSy8OKBYkYKJTWDCY37FWogqIg9gOqwaw=; b=lz2zeNS9KKJed9/idbHiyT52xuRsU8jmRFz/4Mh/ZlYvIfI3NDOCAuA2Mq6nkWqR9E JbggrFJJNsGHx4UKBCtnu9oTDdSfGQ0U63Ow6+INWd6jX6hEEq6oHYFPolUW7dRfVRSs R6LrBwtvFPJpvUbHCmbEJZIDifLmii2lv7P7cjnPv8SxIUaqliMUYRn+f2H7Ehom3Emb Nd3qoLdmJxeoeyBYCcPpjy52IK5R6kCxicripz/jbLDMASJ3WgAJNchlIAe9GvEqG38b Zbs2ntvM8UA5eMvtb3l9ZHTuJ7KdpkCnp5pvlUHdzViBukGzgMT6AgB9Jc6cAayCd8Gp 3VSA== 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=sS022PP0nBNSy8OKBYkYKJTWDCY37FWogqIg9gOqwaw=; b=eLXTUZ4FDpk+b8Eey///vC3xh0Jj1lwBMugpo1BM+K15+FnCUh2n1fp5hjE3Hda7Cz cSK97R0N6UTIhXAmbW6ZfAzPUjHww09xJ5CjR9LJyAgI4MxaP1XUc83Rj03jYs9OIaWA 7TN3xFqyvm0dmSoXCaGV1hFVDFkSPhA/PpGYstefpFU1kbtTY/89TSt2jcImI9/KuIHf 5g/q8a6T7HcmikhtZYdcK0fU5hX1BwfcbB635txWpwYAJSiw6mlDZ0Q89tbNQDAJGWQx DEpHK/yNoEfeAy6jF8i3PsY12vEuB2twwjFYgsiU8BrWXdxkZP/jqk2bZz6e9GHUmzku my2A== X-Gm-Message-State: AOAM533IdWoGs8yXdpRjTDffAMmP89Pw04JqknMh1YbKtreGZ8cPNRKp UBdRgvui9efbpl/E/e1+PgxRnmGqMA== X-Google-Smtp-Source: ABdhPJwl3K/JOiSHRQnSOsLFlsdwEP0YkjR1wD9m+isgUOiNjdnzFZHgt8ubrMgehmtACfPt7lrjI06liQ== X-Received: from elver.muc.corp.google.com ([2a00:79e0:15:13:bd72:fd35:a085:c2e3]) (user=elver job=sendgmr) by 2002:ad4:4990:: with SMTP id t16mr3775079qvx.32.1632394101026; Thu, 23 Sep 2021 03:48:21 -0700 (PDT) Date: Thu, 23 Sep 2021 12:48:03 +0200 In-Reply-To: <20210923104803.2620285-1-elver@google.com> Message-Id: <20210923104803.2620285-5-elver@google.com> Mime-Version: 1.0 References: <20210923104803.2620285-1-elver@google.com> X-Mailer: git-send-email 2.33.0.464.g1972c5931b-goog Subject: [PATCH v3 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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=-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 2D2FFC433EF for ; Thu, 23 Sep 2021 10:48:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B421260EE7 for ; Thu, 23 Sep 2021 10:48:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B421260EE7 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 4239D6B0074; Thu, 23 Sep 2021 06:48:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3D1736B0075; Thu, 23 Sep 2021 06:48:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 24B596B0078; Thu, 23 Sep 2021 06:48:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0249.hostedemail.com [216.40.44.249]) by kanga.kvack.org (Postfix) with ESMTP id 137856B0074 for ; Thu, 23 Sep 2021 06:48:22 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id D30912C6BD for ; Thu, 23 Sep 2021 10:48:21 +0000 (UTC) X-FDA: 78618514002.11.9B7EF3B Received: from mail-qv1-f74.google.com (mail-qv1-f74.google.com [209.85.219.74]) by imf04.hostedemail.com (Postfix) with ESMTP id 9D9CD50000AD for ; Thu, 23 Sep 2021 10:48:21 +0000 (UTC) Received: by mail-qv1-f74.google.com with SMTP id h25-20020a0cab19000000b0037a49d15c93so18684072qvb.22 for ; Thu, 23 Sep 2021 03:48:21 -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=sS022PP0nBNSy8OKBYkYKJTWDCY37FWogqIg9gOqwaw=; b=lz2zeNS9KKJed9/idbHiyT52xuRsU8jmRFz/4Mh/ZlYvIfI3NDOCAuA2Mq6nkWqR9E JbggrFJJNsGHx4UKBCtnu9oTDdSfGQ0U63Ow6+INWd6jX6hEEq6oHYFPolUW7dRfVRSs R6LrBwtvFPJpvUbHCmbEJZIDifLmii2lv7P7cjnPv8SxIUaqliMUYRn+f2H7Ehom3Emb Nd3qoLdmJxeoeyBYCcPpjy52IK5R6kCxicripz/jbLDMASJ3WgAJNchlIAe9GvEqG38b Zbs2ntvM8UA5eMvtb3l9ZHTuJ7KdpkCnp5pvlUHdzViBukGzgMT6AgB9Jc6cAayCd8Gp 3VSA== 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=sS022PP0nBNSy8OKBYkYKJTWDCY37FWogqIg9gOqwaw=; b=WsYXNswYUs0viiQj5HI5UXeuUi+Lpi69E7Urj4Zq6wzb9vDBv9mlGCkJpDDWt0kqHD iN7+576DRxyzj1XzJIh1qk4ByTr2wUSj1RkITOj+MMrvsUb7GFPOFAfnh++Uqo+2dw4h gUkE0cugaAXZyZOSpomreVtMQJx6kHVWilutQVcVeDaE+dWY/aYs/HsZzg68FBrofzxX c3uC7NaI1vGYJGHaLEYz5LwOpYyEeK7gl2XI/Y+Mkc3YxIHdPeCB/lfOmW22uBnu2FYM ZKcGIn+R3FRCP27mQnhj8t86OeuadxU8WkUUQA1Ah3awx6FN3E7QvI/XhqPK2LkcGVt4 y/3Q== X-Gm-Message-State: AOAM532HazwuZy/nWFDUVAHMdXy50dIxjjMfFIacSC9WdL9yGSz3Zgmw MqiwC+5cKauuPu3bZg4BjJDcZFKmHA== X-Google-Smtp-Source: ABdhPJwl3K/JOiSHRQnSOsLFlsdwEP0YkjR1wD9m+isgUOiNjdnzFZHgt8ubrMgehmtACfPt7lrjI06liQ== X-Received: from elver.muc.corp.google.com ([2a00:79e0:15:13:bd72:fd35:a085:c2e3]) (user=elver job=sendgmr) by 2002:ad4:4990:: with SMTP id t16mr3775079qvx.32.1632394101026; Thu, 23 Sep 2021 03:48:21 -0700 (PDT) Date: Thu, 23 Sep 2021 12:48:03 +0200 In-Reply-To: <20210923104803.2620285-1-elver@google.com> Message-Id: <20210923104803.2620285-5-elver@google.com> Mime-Version: 1.0 References: <20210923104803.2620285-1-elver@google.com> X-Mailer: git-send-email 2.33.0.464.g1972c5931b-goog Subject: [PATCH v3 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 Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 9D9CD50000AD X-Stat-Signature: 5tpco44y8g1t9qcg8owirfrp85pbyces Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=lz2zeNS9; spf=pass (imf04.hostedemail.com: domain of 3dVtMYQUKCG4QXhQdSaaSXQ.OaYXUZgj-YYWhMOW.adS@flex--elver.bounces.google.com designates 209.85.219.74 as permitted sender) smtp.mailfrom=3dVtMYQUKCG4QXhQdSaaSXQ.OaYXUZgj-YYWhMOW.adS@flex--elver.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com X-HE-Tag: 1632394101-230073 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 --------- -- 2.33.0.464.g1972c5931b-goog