From patchwork Mon Aug 26 04:23:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13777071 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 A073DC5472C for ; Mon, 26 Aug 2024 04:32:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 26D818D0049; Mon, 26 Aug 2024 00:32:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 220C38D0047; Mon, 26 Aug 2024 00:32:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EEEBD8D0049; Mon, 26 Aug 2024 00:32:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id C104D8D0047 for ; Mon, 26 Aug 2024 00:32:24 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 4D50080B7C for ; Mon, 26 Aug 2024 04:32:24 +0000 (UTC) X-FDA: 82493125008.22.3731266 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf27.hostedemail.com (Postfix) with ESMTP id 5106140009 for ; Mon, 26 Aug 2024 04:32:21 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=It+qUYQY; spf=pass (imf27.hostedemail.com: domain of sj@kernel.org designates 145.40.73.55 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=1724646657; 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:in-reply-to:references:references:dkim-signature; bh=VEBfipQp83R91F5X5z4qT7E1HhYkxeXSy5V4t8cFx9E=; b=zMuCaKpZtix2rPP9lO0vp16Xh5odr4jY+h5+piAyuD4NAwMD3juQNN4dhABBtYlRQ/xZ/h xTHyaG/EbRtFB8fhe1UR4r8tgQkLqmY4cNaPYur/7JFy7N2JmAPQFUXfZ2POajTxySc3iG VUKC0UE0lcsnEPhtKLOL174nP+laQ+c= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724646657; a=rsa-sha256; cv=none; b=yDGrHMndxV9Ht3hwXtIFFhW7s/IfSR79XHEkli/LATpFxMVJFj7Gzw451MFUChb6nl4xrM YvE3RMu6mONO4ed+i3dvwne6WHtkVO+q52DNFrSseg2Fef+z13Iynmy35rWP9DlmaundhK +prbXqv8/iWAQSQsuQu1O7cKm43hXEM= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=It+qUYQY; spf=pass (imf27.hostedemail.com: domain of sj@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id C3DF2CE0B59; Mon, 26 Aug 2024 04:32:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF9C4C4AF52; Mon, 26 Aug 2024 04:23:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724646209; bh=UHW9Q+oQECc2cZmhHjnUjTteD4lWCzsp9j3YCv5KfTc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=It+qUYQYI6bSGiBuQ7eQvfcSLKDhnTSOby0Gfr09tqVkz5soNjjwMncsbWCyBgWYw KIUCcHid4uZAuLNfiYE48GT2Fz/TLtJIMk93WIZXcYbq9Ux7L0OHPS1aSGaLLKbxsI Hzg/rT/iHuxN7d3EeKiu9G+9yYL9sKFzZEukxKdRaCyWZL/gWJGIuYE0dF3POnwzBt wOiALKG3z4HYIHJsb9EntuUgldbe3++qPlehVsVaA3c3Q6WXkU9klzTVSmARS6yQpM 3W+s+ZQbKJiJ57juiuAckFvMaZmKgV/0VwFXdQJ6BgbRbXfVLmV504mjgUkpzLnUig gWRVkzQ6WcBgA== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] mm/damon/core: replace per-quota regions priority histogram buffer usage with per-context one Date: Sun, 25 Aug 2024 21:23:21 -0700 Message-Id: <20240826042323.87025-3-sj@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240826042323.87025-1-sj@kernel.org> References: <20240826042323.87025-1-sj@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 5106140009 X-Stat-Signature: 7p1yniax7o9e5s6widfy4gu6hbqw8xh4 X-HE-Tag: 1724646741-905099 X-HE-Meta: U2FsdGVkX1/BBihBafQBDo3praDJduOc/ulnL/BRQn/TDI4wb/F366vD8Y6Ex4yvjSFD+uw4Ejk39ZE3nm3mfPApzr3XVAest54ShLj0JdBjyejUVRdb+9NMW/he3kY+LrdTu4vyJC6NvVNXWxTWZeQU0uvjLBJ3grY6aUENUC+pxH1TgEA1hKxZJTJ+3bOuig9nwiacQ7IuBcYTCqNjTRq+4X2eLAGmJRPezR08RYZe56dldQrBs80FfzRcXQFA/IfuuHWcZhocjIqltcxvNsnWQvPO3Bi4j9Oo+pWtV8fGLBJxInw5bUKjA7aqDu6iUe7qCCPm2+Y59cYwz3ek3LBxD3GNFJukVswLw2uEkKag/1/Ha8nvMML0AS4JbfZ7G18/aYfz750S/eTuSp1VVrg0bqUNt+DZ5PcFeVX9ipsECdE92Vn/0IF9DBhDVgHR/xUrBibhoap4HUnenh1ndmpg3bur92jVpLAfcmIi4Wx2zBHLpuZjQAxLfjx1lTJ1QM1/WW+Z2ZjqfrHHE33oUDJ4amM7E1pqAfxh64uKkRTl3sJNc4UQQWtvQ7e2NKs0Sn2ZcFQKTMapJk84kofwWdjMv2/WHFyvK1v3Vy6KzOZZY2AXa8baebH/TXrvd2Ts2ojfTI4YRrdNvWCBgejM0B5ifRyDXxp3gjJ2JODx7dLra5igtO7hN6ozf+b3WAajDE1qzh30djtke7Kigpj4rC1TWEKxK1FBd6B6noeFYEFP27mg2WHE4UVabuF1GQapAn3mp1HgXJDXPDluFrCCoiGL/yxQzxXbfjf0b7L20C3Hn5mlUR6Ckd7oqFrse5tlxBXOOB7OFT4vkZE3o9HP8l0uAZLVl2P8w9OVuqxpTObBjeQyujKtM2raZD2qBghoSTpvvLxxpVBzjV1JdS+FtJg2ao37pJ/c0wY7ksYdWZ8YQ1EjS2dSlK0POnTZaNJZOr3iKEFbf99awspz1MP TFhVeee4 Z+bnRkS031I5+x2hxvSkvyWgkEnRvlL2phAObhBu+L1qWwXM+US8YMHJbPaFHdvEMqcaEV7oCxaItd0/9XvR5MQk6bafYiBwARBNi+dNhEJAjtUtS4BrvYc6QzU0rtnPTbDL1/SkCrg9OdfRs12weuZPBQmLJnNdTvmVOGaduSmAcWTpbzNaitvla61BDuxPQNHXjc3xZltFsDoHysjGaTE+MjQel0mAHtGr729eNyvCdPDrT4Ck55hF6JA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000016, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Replace the usage of per-quota region priorities histogram buffer with the per-context one. After this change, the per-quota histogram is not used by anyone, and hence it is ready to be removed. Signed-off-by: SeongJae Park --- mm/damon/core.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mm/damon/core.c b/mm/damon/core.c index be3d05357667..a1c32becfc73 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -1623,13 +1623,16 @@ static void damos_adjust_quota(struct damon_ctx *c, struct damos *s) return; /* Fill up the score histogram */ - memset(quota->histogram, 0, sizeof(quota->histogram)); + memset(c->regions_score_histogram, 0, + sizeof(*c->regions_score_histogram) * + (DAMOS_MAX_SCORE + 1)); damon_for_each_target(t, c) { damon_for_each_region(r, t) { if (!__damos_valid_target(r, s)) continue; score = c->ops.get_scheme_score(c, t, r, s); - quota->histogram[score] += damon_sz_region(r); + c->regions_score_histogram[score] += + damon_sz_region(r); if (score > max_score) max_score = score; } @@ -1637,7 +1640,7 @@ static void damos_adjust_quota(struct damon_ctx *c, struct damos *s) /* Set the min score limit */ for (cumulated_sz = 0, score = max_score; ; score--) { - cumulated_sz += quota->histogram[score]; + cumulated_sz += c->regions_score_histogram[score]; if (cumulated_sz >= quota->esz || !score) break; }