From patchwork Thu Feb 27 01:57:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13993522 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A215CC021B8 for ; Thu, 27 Feb 2025 01:58:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C58B56B0085; Wed, 26 Feb 2025 20:58:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C082D6B008A; Wed, 26 Feb 2025 20:58:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A81C46B008C; Wed, 26 Feb 2025 20:58:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 871756B0085 for ; Wed, 26 Feb 2025 20:58:04 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id E7652814CE for ; Thu, 27 Feb 2025 01:58:03 +0000 (UTC) X-FDA: 83164064046.07.2842A1E Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf02.hostedemail.com (Postfix) with ESMTP id 6196680002 for ; Thu, 27 Feb 2025 01:58:02 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=fOWpGXfk; spf=pass (imf02.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1740621482; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=epk3GQu87MD0zv7fVa0YwbQV8DPrBxEvfToSwDYE6K8=; b=g5Rd/0623oJ5KDPHymszUwoRi2PbDfZU1Q4UYBRjhcOM7oV65TrsQ4hwC1IYiKo61K+3Xw +Sd+fDXv1tA+a2oLrsE3CFYN4UcW9+XfcacmuIKionqnP4SDk37DMdEfblqCJLyn7jcetJ zYuPmJDw2gkBRxIvLoLGtJjoK7EmD/M= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=fOWpGXfk; spf=pass (imf02.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1740621482; a=rsa-sha256; cv=none; b=zAVyE0bn3/glLwFevO9p/6PuUkNqxHx+u/u2kbgblTSMygi+uXWbMvXtJl4mSO+6jlzOTD XwZa1umbQcHdjhsOTjhzQNYeKQIv8jqPxFvpAZWzBqmklk0vxqcziseRwnIXSodXR44dJ4 5eOpWAtG/67qD9h3sPStyhdHX0ka1B4= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 711B25C7622; Thu, 27 Feb 2025 01:57:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D83F4C4CEE8; Thu, 27 Feb 2025 01:58:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740621481; bh=hgqh7MqdmJvWtdbx5/3KdrWV/dWlcpuONqHSz/QzEfo=; h=From:To:Cc:Subject:Date:From; b=fOWpGXfkoLZyZD7fvCkVwTdLF4AyoJjQstCIhsp2akHnGStTiIW8ZSXL2L03VJpmr hl19ZU0jWtzk83/hQww3kfrjin3xxI0jvLLbyoPU3xFrBdlfvcZ8CjkurZRxiCbd3i 2I0dwPkndla3FJzgMxf32FoldIj1yNK7JTHvwilHBKC4/iKJC5tsy0Vjtdp9rL77CW Zi8kh4Dy+6AiqjyVhdAS+zqBq1+63Sc/gXKgD7wXzLN+gyLCsE+Jr42Q/ALlzo/e9R Gh2hWni6iJNuHUFHa70MKqTkqzIVWBgGcF4LBxpsD0YwCHjNnpIsAPir8c5NWtpOz3 P2lbgO+MS/5xA== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , Jonathan Corbet , damon@lists.linux.dev, kernel-team@meta.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v2 0/9] mm/damon: make allow filters after reject filters useful and intuitive Date: Wed, 26 Feb 2025 17:57:45 -0800 Message-Id: <20250227015754.38789-1-sj@kernel.org> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: 9okx94sfya9ek9omj3ttgw1ne8q3jnoo X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 6196680002 X-HE-Tag: 1740621482-908178 X-HE-Meta: U2FsdGVkX1+sAxbWwv8umfUucS+KTpMy3on41DdxaJRUdwtV+dKSVNWecW09jZx+eUOILzaJmBtvTbZy9X5MxCRHPFAUQjJtJfs+vcGvXCuAih3bU67dW3cDf5FwJbUpDhEUvlvet1nA1om5/Heb/mnMWCzV1z4vAtX0Cq/gKUGb8LF5YvoMxGgqVyPbE+Km6n9h1Z1map0YZDvYA3+CQ5YM4lScLy17RaamX2kgZXsOeK7r2p4tDFo7szdaNltRhnHK+V01hftHfse94OSzG+HqhhfY8zmS8ezp241f4tMXvU9V5JmFp5M0dB9neTDCsZaXChD6TQvUM4I22q6piDZ2QguMkgghqLFh/xOTszaEb1wn8Cfa4TA3Q40raMFCZTJQQNFeHbeXU0JK8uLTWYw+DCbXjMN57Ziggze3EYEOA8wHNkhy3tWdyz8iznaAley/6WQDk7Vp6TmP5G545Ulu03N3XWakAZzZ04WsvuHRBofAHyBfXhzjMYYLJEuX9g4vAZM7OToyrRYoPFHC9rRhg6VO8vGB46MFxfvZvykngzTAU78RBYqEQG3u+SITEeUNTDKCd1pAiD+rCIW7f39un1CHL2TfGOR6t8l0wWRPkdzx2pSLYCOoF4elaOY1p2WV+P+33wPi726JNAyu/UCBeiR0/Ye5LL+OROpokeeez0DqZzXwUl7dLgdTgFp0P3PdwSK7DhRpLHZFAv4eCpIGRnE5foQXm1+eAeKsLrF5/4q39XWmYtoTxNe7xiKAhlOnfvknx03LPlNnSehEpFwkfJOEl/UxnG8NAxER5uvNqEqe+XTj9ZOHBsOv4bSce21ZXZc9/kyMt31+CLqICvp6gl7ojLcPRIUKfRCDGQ/8WY63pgK6F87KJ/LZYaE36MOOiXCHOOLmHqzOjq0F6QCsJk/xmoLeQG15IYrvqnL6MZKjVpQMD2RE0784U6ng0yYf4lCBi3Aa6qR8og/ WGI2CPmq ww01PjhblzMZTmNGtOZXJf1Q9qYImbZ9vsgWAfikqIHjvEECa8sLicctbc0CFZZzBnbpLQ9SVbF6hY/UIfvHy/hyRmezag1Bnp5RR8hIzBw9RF2KAnOi7NUmCeWwjA1RgaNiNxfuH/76JE2GV0/CAeLzmL/O4z13I95Hh2hlQAnFByoNpdlBL7mKOJc77UkUSBGM5oJShwLDFTSvwCz8oEg2EPvoJ6hKMX/yKLss1S6k8q58= 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: List-Subscribe: List-Unsubscribe: DAMOS filters do allow or reject elements of memory for given DAMOS scheme only if those match the filter criterias. For elements that don't match any DAMOS filter, 'allowing' is the default behavior. This makes allow-filters that don't have any reject-filter after them meaningless sources of overhead. The decision was made to keep the behavior consistent with that before the introduction of allow-filters. This, however, makes usage of DAMOS filters confusing and inefficient. There is an apparently more intuitive behavior for the case. If there is no filter at all or the last filter is a reject filter, allowing by default. Update the filtering logic to work in the way. Decide the default behavior as the opposite of the last isntalled filter. If it is an allow filter, reject by default. If it is a reject filter or no filter is installed at all, allow by default. Note that this is changing the old behavior. But the old behavior for the problematic filter combination was definitely confusing, inefficient and anyway useless. Also, the behavior has relatively recently introduced. It is difficult to anticipate any user that depends on the behavior. Hence this is not a user-breaking behavior change but an obvious improvement. Changes from RFC v1 (https://lore.kernel.org/20250220193509.36379-1-sj@kernel.org) - Set default behavior on core layer filtering stage as allow if any ops layer filter exists. - Wordsmith commit messages - Rebase on latest mm-unstable SeongJae Park (9): mm/damon/core: introduce damos->ops_filters mm/damon/paddr: support ops_filters mm/damon/core: support committing ops_filters mm/damon/core: put ops-handled filters to damos->ops_filters mm/damon/paddr: support only damos->ops_filters mm/damon: add default allow/reject behavior fields to struct damos mm/damon/core: set damos_filter default allowance behavior based on installed filters mm/damon/paddr: respect ops_filters_default_reject Docs/mm/damon/design: update for changed filter-default behavior Documentation/mm/damon/design.rst | 10 ++-- include/linux/damon.h | 11 ++++ mm/damon/core.c | 90 +++++++++++++++++++++++++++++-- mm/damon/paddr.c | 8 +-- 4 files changed, 105 insertions(+), 14 deletions(-) base-commit: d5c41979a39f18ccd660b25eb79e805eb5442e18