From patchwork Mon Aug 26 04:23:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13777070 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 69DCDC5321D for ; Mon, 26 Aug 2024 04:32:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 349CE8D0048; Mon, 26 Aug 2024 00:32:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 299C98D0047; Mon, 26 Aug 2024 00:32:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F3EC18D0048; Mon, 26 Aug 2024 00:32:23 -0400 (EDT) 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 BDAFC8D0041 for ; Mon, 26 Aug 2024 00:32:23 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 50684140B27 for ; Mon, 26 Aug 2024 04:32:23 +0000 (UTC) X-FDA: 82493124966.07.99E714C Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf26.hostedemail.com (Postfix) with ESMTP id 49FF2140004 for ; Mon, 26 Aug 2024 04:32:20 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=qPWGxV5F; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf26.hostedemail.com: domain of sj@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724646678; a=rsa-sha256; cv=none; b=pYz7DNBxa93q9CyokPZCe7ob/YGntfRdIs+YyWyKMK0ubNRSfx7z+SPp4Z9OtHS6TRMU5U P8IDJt93FubjlOfJpz9AZcVZf2ys4Onq5G36XCw4+78zdKQhEAbsZlP/dudE5FJSvs1ojp gI37bww7nscfBXPPyTsFwRexKlvzqgo= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=qPWGxV5F; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf26.hostedemail.com: domain of sj@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724646678; 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=uFc6wbTwG+Z85Igxd/hUYHJPjPQEofHN+wRVYeCvsIQ=; b=kDwHkdSCVtjZvWGEE093A9tTZQSd9f9xoOyNe1qT3IGakYDPtBE/x80iSaMebHzLqdtHtu uf6fuhqx1ykSG7N/2C8/4Li2P03P36Qj6pNsyKOayXOeEUOHdQOQsb4WVN9jtYl4I4hjvC Q4vBJD2wZcbisT/cyvHV4AFtdQR9BBE= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 48B45CE0B98; Mon, 26 Aug 2024 04:32:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6A9BC4AF67; Mon, 26 Aug 2024 04:23:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724646210; bh=8KWTe6g417NjxQYOu8DbwjfveiZLDo0pwWEWfK9DvjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qPWGxV5FGARu1NIS/Xn8xAdpW19/evFCGNH3EP2m6L+LSg6KT4VeBp4oB/ThoQ45D iPkF6RN+oEnwI73janQ9Fh7Qk7qFKyntXTo0FUv8/LTRAKWsiQrAKE35iKKLamOuj5 45o59P11Egip5YnveSSZXeK+MNesvM3tWvaVbBtmwYZSCoGZEK2ReUJMYtKdChWlRJ zoN4nRQPQtNbNw0jTgRa0xMaYNz+8/NayjNYhNkHxyzt8p3dsYCwxqE5d+zsiA67Cm 2x9BkA4ElJZJ30BW8EukK17m/S4jApjRXW7HBTmWn2YEcdmq9VbmWi44jIH/SL0d0a azOewe0o615Mg== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] Revert "mm/damon/lru_sort: adjust local variable to dynamic allocation" Date: Sun, 25 Aug 2024 21:23:23 -0700 Message-Id: <20240826042323.87025-5-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-Rspamd-Queue-Id: 49FF2140004 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: kuem4fi3z1sdybqy1sgmnodftbgnsrhp X-HE-Tag: 1724646740-143042 X-HE-Meta: U2FsdGVkX1/B+pk7CroiiLz35J7aJR4n3koDQcJP02kkh7LN31vByIZOdBWTQMI2KIZbT+uxUetkW32CuxS6zwy1Kro/JYL6jDePoIBgziQzdA7fwqkOqoZnDxIFANwtEQEBOXOmOPU+5M5ucZMKT5pKHOsuQOQSgGEFaiYuifktPWmbx3b+d/9ulJQu6leL8388oYbfVnsoH3+plE+jGClCycBFlKv/94c96+4oIlsjlyYdm1/Teh67ibuTTygeyXVo7lGkdw8dzpKHXUV2MengukFnbNJamoAPHbzp1nHO6AcLwChC6zY60geMJPNQ2o5SVKAZBMHj820/AFWfXhxlz1iFLF+m+ToOmRb7D7ImDUImMmgYLWLWzt144rull84REfTYApafj/Of7KdwNMhvyXPidg7X7p+gBBUGafm7x+PQjXMb+dhCvqoO1YWl3EWdjJ3q9CgQTuhYGeW8DxqivS+VWPpYWkkm/7lieQgY+xSxlq2z2uJ5bP1Ls2uWivasQzDaEVSDKWBJ2cuyfpD5670609YgXG9hyNlzSkDKwNLvEpGhqtUjRyNBsKZm22CaXr3koQqlac/4m7Uhrn+rpGDPTYqlj9m1GpBGrdsPFrPXfzN+yvrFGf/N8RXKLXzfI9LU0tjIzlIYqNPBfFod+89Qd6WmPFq9oh6kWqiHx+A7Du8QDwNWWLLCSccbMzmVqUigJ00X5UKtEPFO2oahqMyJ1slYxD3k+BJXI48OgBTFSTkLZHSFiLAJB5t46s59p098Fc6IT1nwceE8lVhw4rv2aBMHUf8KvKMpVVjjkXQmR+S+zo/55ef1MEfmZlhR/pwceCkcRWqHu0HdU7ctTS/rn5gjjUsCvR4BYzH24ZQEPRvhgkb48BiCzNAXubf6P2fqlJWVoG1Jn6GdnWpfSCuqAlVmixpOPdtkjDFrYb+Z84Fy6GPjthCTV2NU++Gs+PBrsZkH8BuKUeu 4W/07lYp grzDLhhIYSjlORbYImlPXJ+Etv9Ps/TD9zLchKTfjkup0L7RoRQffODsx5FaMxknxy3F81VSXoxUQ8Td8yt+wmubapN9PA1uui9o2CYF0ffuFS0kfi/g1DvFvVnVrF+PHX1ABndT/ULt9AVaRaXx+aIAyjAMmaN6dQr7xOWY3LvdiM3vAhEm+TbpzSoqsCox4y5tQ2qZA20LBdyY6wwdALWMdp+OuPtUbrMCM5Yhz3pbVoi0gm3zvT7LOa2wpKAYtpSJ8fkQHIPr4VhjGQF1tORJBP2Lw0bRZQdnS 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: This reverts commit 0742cadf5e4c080aa9bab323dfb234c37a86e884. The commit was introduced to avoid unnecessary usage of stack memory for per-scheme region priorities histogram buffer. The fix is nice, but the point of the fix looks not very clear if the commit message is not read together. That's mainly because the buffer is a private field, which means it is hidden from the DAMON API users. That's not the fault of the fix but the underlying data structure. Now the per-scheme histogram buffer is gone, so the problem that the commit was fixing is also removed. The use of kmemdup() has no more point but just making the code bit difficult to understand. Revert the fix. Signed-off-by: SeongJae Park --- mm/damon/lru_sort.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/mm/damon/lru_sort.c b/mm/damon/lru_sort.c index 0b35bd5fb659..4af8fd4a390b 100644 --- a/mm/damon/lru_sort.c +++ b/mm/damon/lru_sort.c @@ -148,17 +148,12 @@ static struct damon_target *target; static struct damos *damon_lru_sort_new_scheme( struct damos_access_pattern *pattern, enum damos_action action) { - struct damos *damos; - struct damos_quota *quota = kmemdup(&damon_lru_sort_quota, - sizeof(damon_lru_sort_quota), GFP_KERNEL); - - if (!quota) - return NULL; + struct damos_quota quota = damon_lru_sort_quota; /* Use half of total quota for hot/cold pages sorting */ - quota->ms = quota->ms / 2; + quota.ms = quota.ms / 2; - damos = damon_new_scheme( + return damon_new_scheme( /* find the pattern, and */ pattern, /* (de)prioritize on LRU-lists */ @@ -166,12 +161,10 @@ static struct damos *damon_lru_sort_new_scheme( /* for each aggregation interval */ 0, /* under the quota. */ - quota, + "a, /* (De)activate this according to the watermarks. */ &damon_lru_sort_wmarks, NUMA_NO_NODE); - kfree(quota); - return damos; } /* Create a DAMON-based operation scheme for hot memory regions */