From patchwork Thu Feb 20 19:35:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13984433 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 1C794C021B1 for ; Thu, 20 Feb 2025 19:35:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6B78C2802F4; Thu, 20 Feb 2025 14:35:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 667652802F3; Thu, 20 Feb 2025 14:35:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5310D2802F4; Thu, 20 Feb 2025 14:35:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 363312802F3 for ; Thu, 20 Feb 2025 14:35:17 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id E167982C2B for ; Thu, 20 Feb 2025 19:35:16 +0000 (UTC) X-FDA: 83141326632.09.7691322 Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by imf20.hostedemail.com (Postfix) with ESMTP id 6386D1C0013 for ; Thu, 20 Feb 2025 19:35:15 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=XFb75Kn8; spf=pass (imf20.hostedemail.com: domain of sj@kernel.org designates 172.105.4.254 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=1740080115; 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=fx+SPEEJZ8sio17CFNSodWDf7u2QxEQor9Ww+Ke04D0=; b=gZJ+Cv4sHEqFT+3XdTn/+aW4L5++QplpST5NvmLRVPRqWCFSIQ6/GMja5XaivUzSphZOD7 bSZG+qQYs4sAbUcwi+MhqBiXW4Og/x4ZwM7cWffDF0hW+RkJeRmnMRx6cyikAcHlfQWCJA otqujgtXsEEXeIB0phbG0MzqkWogM0Y= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=XFb75Kn8; spf=pass (imf20.hostedemail.com: domain of sj@kernel.org designates 172.105.4.254 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=1740080115; a=rsa-sha256; cv=none; b=EDmXMeY1Rfld+Qz+JQF3bESB1wKk40onSRUMA1g+3gVZ34VDnqnU4pvc7ACgdqu1psMDQ6 y6DudSrfAuD09Ec5Q1mV7vugOfCDIdhDC0LcBUkd8T6M7tvBsrzcPR2JSKSgfiHA8vIGW6 JhzfsfNToKmd9e0keJW9VlahkaZIp38= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id E6FCB611CB; Thu, 20 Feb 2025 19:35:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A0A7C4CED1; Thu, 20 Feb 2025 19:35:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740080114; bh=yi3O8IIfMq3Lsu5eEmUuglusvyN/6eeaRwtU83MpkKs=; h=From:To:Cc:Subject:Date:From; b=XFb75Kn8ByovWtzTkt2RAWuqxhlOEd8p4kzabpZXtM8AnGswfeQ5XhucPLLGOiRFZ gwaoqSr2szYfURtJWDFJtJJFbjmGFJqOaKJS1sRSt21O4os3Jmo8G0DjQqKwyY6d7k 8uvqkNsPKahsi9bSAah2MHxqhiMyIjzfDAU04xZg3ePC5iUP3q3uWGjgbExdhXoJJe 2XG9471u/hcCBoGxFm1dutOz0DcFP/6QQgr7JiHCreF7iOZbScRz5JdOkNGn5ZrmLV 1EHrMYNm0lmZN3A1je/OvL0Obea+iWEKGVUAwHDbldg/eoRrusqZvBuO8mvw9Pi9TL u+Xgcwy0Rf4VA== 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 0/9] mm/damon: make allow filters after reject filters useful and intuitive Date: Thu, 20 Feb 2025 11:35:00 -0800 Message-Id: <20250220193509.36379-1-sj@kernel.org> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 6386D1C0013 X-Stat-Signature: s1hboy5j6eiwitm5ppgyfdoissq7jcsz X-HE-Tag: 1740080115-957647 X-HE-Meta: U2FsdGVkX19U6+iq3HhI7kKaxT22Z34WZJRU2hERjmkJpVcxe0/3ibTDoMSBBoIiixVoP1MV9sgs0yFMVn2wIaMOorj/3OkZwtXfJe4DB2bLBoE+Ixd3Vi4gEmdR9lLFXHHxs3MlUb8hU0213y99f4mLepgMVORtdBXH2MfCblYYto15YNbWLJuuKwMPukWBz/MbfFzw5qyRy+44vDv733m4uAzhHLoCqicsDUNKz/UPq8se94L371gjJv9p7Wk0ER/YWOv6TCOpKJl6lUQIHrONM27hzU8vnk0KZJjWuNuue2R2lpoHWK+fxhsAB3Np/j9L3+kafniNBwy6cWpUqkP0cD2cjRNpVCrl9EBN0okibpdJw/gPqC7MJfVz2IJo1+fnN3qMRSBpYSkC9egUfYBOcFFI2aGuRmU/QT9VBsivvL2RJS/Rb6KynNAfF8w3O/TPYLJ2JsJ6y31QMl6f9uo+34JvVSVajKb9opZmFWmZmEtr+Pk2YYYe5yaWto8QafE4aB7m38OvZSg1bImdkULx2oMo5exLGk6nZGC4MQtNXs+DJPzgKDM+PhLeJeC+Ts+HZ78/JfctegnKHSh78rqScJQw0TqL02iFX0LK//FdTDZ7XdG+AIPSXgJelBInVSUn7bKW7W/an8Uj19WVtlS36K0kyJoq2AjZkKmemWga1w0CCtQhPpBp4xRSl5hjXS5HOXWFKa/5gWzaZX3TJwHuEQKd7Y6ev7mpct0KtiVy0BibOH7pn2ZyOnnK8px0HMm/VwgGKiuGSIItIOXm0Gd6UfkeTwE2wlbWYvwb/9/xMbKhXAunTnKaC74KxtiAJJc4pSMUVn9SdjwM5z25VObb7NVeqhZE9hcPnRCGpp6ec0+sfIoxVcWsUMFNSzSfFF/bH+JupP/iwM6/4INC1kSx+P3PAoNPwBH43wwuRDwI+WXY4duIQEELSJTciEyDtOdTHwk3xqnXtj+0PO4 ubtJdbVU t9vtCabwDZJlatciTwo5dpVufgMJ77CbT/6g1r5LENXX0hQRi+ul8EKuSTvBJ/iXL7SG73eHM3c5LxTh92UxNzJPP7u+Qk8hgCSg22S/E4fMZfSpnTHBMk+Y8XF+S3bXS5rKl1ektpUlwNzUCiGMsarkeDTOwp6N8lQ9s2nfj9dmTlUw4gywAWw6FCrqAlEIRkqO++but9u8Oznw= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000024, 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 action only if those match the filter criterias. For elements that don't match any DAMOS filter, 'allowing' is the default behavior. This makes 'allow DAMOS filters' that don't have any 'reject DAMOS filter' after them meaningless sources of overhead. The decision was made to keep the behavior consistent with before-allow filter behavior. This, however, only 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 installation 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. 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 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 | 87 +++++++++++++++++++++++++++++-- mm/damon/paddr.c | 8 +-- 4 files changed, 102 insertions(+), 14 deletions(-) base-commit: 3fb99e5d512f03963c91926628fcc08a96ee07f0