From patchwork Tue Sep 13 17:44:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 12975072 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 8EDF5C54EE9 for ; Tue, 13 Sep 2022 17:44:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0A2406B0072; Tue, 13 Sep 2022 13:44:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0528A6B0073; Tue, 13 Sep 2022 13:44:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DBF446B0075; Tue, 13 Sep 2022 13:44:56 -0400 (EDT) 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 CB18C6B0072 for ; Tue, 13 Sep 2022 13:44:56 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 9E9BC1A037D for ; Tue, 13 Sep 2022 17:44:56 +0000 (UTC) X-FDA: 79907787792.17.49EDBA4 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf28.hostedemail.com (Postfix) with ESMTP id 9CB6BC00C8 for ; Tue, 13 Sep 2022 17:44:54 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0DA36B80DCB; Tue, 13 Sep 2022 17:44:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B4D8C433C1; Tue, 13 Sep 2022 17:44:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663091091; bh=LTJFQvu3fbUeoBlxoYkTj8tKAF1KlT7wckZz/6RxiTk=; h=From:To:Cc:Subject:Date:From; b=ZH1Dt/WEu+RKqwakhbFJdLk1LRaoAY6d4pBecFD6CWCBB29RD8d9bRfAAAaeBSX6C J0CX8Ug8EdBVLn/vyrwrvjm02pykj6JLmd5iCoKLbASMe8H/WM5CLDwpSejRPuVtTN lvcEW6KKG3POEsv3eX4pnhNGTUUf63tgNuj57ns8zhNcA1yk6GUgjyj0AFn/RFU1+z N67qc4s3i7+lq8pKR5UiAleJFeo8yg6V+JellPHu7HT/z8PGh5kzu6qYyHhGq5LpJr 7qxKE/2WauPs0gTPhIMQgSC70NQ9yAnw/CYd6n8B3QQQemnkB1pSDK2UOZrSRczE20 Fn+UI+hVckl0A== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 00/22] mm/damon: cleanup code Date: Tue, 13 Sep 2022 17:44:27 +0000 Message-Id: <20220913174449.50645-1-sj@kernel.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="ZH1Dt/WE"; spf=pass (imf28.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663091094; a=rsa-sha256; cv=none; b=Tq9gv59qUNYsrme/ho6YwEBJf06eQtJ4sS3HtT7Yl3VbhEF/ht1beiJxlcbSMdnYqW46f8 T0iAgVpY8XXjsCfd+FxXZRyox2W+6zPGEl3FYEsi5iXGiqtZukfoT4zB1yd1p4Rro/ruzf toUI3hAcklFAeAnfNkZ9VzYFPGBs+3Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663091094; 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=c2Z6SQm5TS7CtHRyNQPVSgSxYsSCbwFH1RKx81iLjkQ=; b=e0vZSKHcOxPiJFQC9d3HllFRl/wRbjd3YWZIuu3hp/8bP6Ebk7PPMUG08EQxEv4O/2Pzq0 ATtUe8KNTC5bj5BxUl06sJL6RqE0kmBdRw3qdnu7rupCLBO/ycbDK9xluqlfqcbk3AFojQ bWZMYQDqhlYQqsBAfJ7HgKAmQ4V5uIQ= X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 9CB6BC00C8 X-Rspam-User: Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="ZH1Dt/WE"; spf=pass (imf28.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-Stat-Signature: b1mkuq6si83uyue6g435f3twxhsj5gpb X-HE-Tag: 1663091094-46762 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: DAMON code was not so clean from the beginning, but it has been too much nowadays, especially due to the duplicates in DAMON_RECLAIM and DAMON_LRU_SORT. This patchset cleans some of the mess. SeongJae Park (22): mm/damon/paddr: make supported DAMOS actions of paddr clear mm/damon/paddr: deduplicate damon_pa_{mark_accessed,deactivate_pages}() mm/damon/core: copy struct-to-struct instead of field-to-field in damon_new_scheme() mm/damon/core: factor out 'damos_quota' private fileds initialization mm/damon/core: use a dedicated struct for monitoring attributes mm/damon/core: reduce parameters for damon_set_attrs() mm/damon/reclaim: use 'struct damon_attrs' for storing parameters for it mm/damon/lru_sort: use 'struct damon_attrs' for storing parameters for it mm/damon: implement a monitoring attributes module parameters generator macro mm/damon/lru_sort: use monitoring attributes parameters generaotr macro mm/damon/reclaim: use monitoring attributes parameters generator macro mm/damon/modules-common: implement a watermarks module parameters generator macro mm/damon/lru_sort: use watermarks parameters generator macro mm/damon/reclaim: use watermarks parameters generator macro mm/damon/modules-common: implement a stats parameters generator macro mm/damon/reclaim: use stat parameters generator mm/damon/lru_sort: use stat generator mm/damon/modules-common: implement a damos quota params generator mm/damon/modules-common: implement damos time quota params generator mm/damon/reclaim: use the quota params generator macro mm/damon/lru_sort: use quotas param generator mm/damon/lru_sort: deduplicate hot/cold schemes generators include/linux/damon.h | 34 +++-- mm/damon/core.c | 87 +++++------ mm/damon/dbgfs.c | 15 +- mm/damon/lru_sort.c | 303 +++++++++----------------------------- mm/damon/modules-common.h | 46 ++++++ mm/damon/ops-common.c | 4 +- mm/damon/paddr.c | 29 ++-- mm/damon/reclaim.c | 220 ++++++--------------------- mm/damon/sysfs.c | 12 +- mm/damon/vaddr.c | 4 +- 10 files changed, 246 insertions(+), 508 deletions(-) create mode 100644 mm/damon/modules-common.h