From patchwork Mon Aug 26 04:23:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13777067 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 3B3B9C5321D for ; Mon, 26 Aug 2024 04:32:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8AD478D0040; Mon, 26 Aug 2024 00:32:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 85DEF8D001C; Mon, 26 Aug 2024 00:32:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 725398D0040; Mon, 26 Aug 2024 00:32:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 48C878D001C for ; Mon, 26 Aug 2024 00:32:23 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id E276F40B7B for ; Mon, 26 Aug 2024 04:32:22 +0000 (UTC) X-FDA: 82493124924.15.BBD905B Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf19.hostedemail.com (Postfix) with ESMTP id 0009C1A0004 for ; Mon, 26 Aug 2024 04:32:20 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=T3Xn9pK9; spf=pass (imf19.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=1724646656; 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=0y/HE7gkn3P2sLo1YLAAHcC6xJTnuCqT0ySVn60G+GY=; b=WUNmfbeWZzpzb5ZiRl1cr0novrpE2MNT9ygqPajzcj6dY59uZ/J9geEk4XMcjeXXTgbG5j xSFsT+KXRl4zONavuXtxXSJWrib53dGryosOKA7YKqzBcPdcQ5LyTgM2pyyilNKOmGemLw STe5WtOkyYAfCXg/jHaBnISXMWW1JqA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724646656; a=rsa-sha256; cv=none; b=C6lZOCJzjl9aaqO0NR8VH20XNvJx6kR6pcHl/uv73FBhh5zNa+HpXGQxM/DUZa8IDIgu4K hyz+2V5kMpyW4yYCm1Xa5iOhKLSHwN6Tj1M76a8qEseaH3Cp0mvKO71+TvO5r/pkwWxdSv L10CnyiAEh6rhD679G6zS7s3hBZNU8M= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=T3Xn9pK9; spf=pass (imf19.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 88BF6CE0B7A; Mon, 26 Aug 2024 04:32:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A28ABC4AF17; Mon, 26 Aug 2024 04:23:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724646208; bh=BroiU6LvHGB1xtFWjQnFYmOofMoZk13LGt5gazIOj1A=; h=From:To:Cc:Subject:Date:From; b=T3Xn9pK9AoUyl3B2w1eC5x3iwuPxCg+S9+S9uKTHxW5pgVrwHtokfw5iHDw1lKi3c k3LzHH5eDBMuBPkLxljzEj8ZeBW2JkeKjS514TyZZ2fKEUNAz1OazvcRI5WY/PtdWB cvDngYY0oOxskkbZyacQTjli9W6w84Wn9XoX+hbVXktiCeBkYzTs2OvFWZ8flf9ecS JYCE4eKsoF62Rmay/b69pdqVRbn0hq1nQ47F1bDd/rDuqTSC2hcysbk3JVx48lnCuO xfC4tCaPs8rCJUBP9HHplUgMz0a/hGdDUqc4BrCnGpQ0YFn2jQwAi85YjYPTIax3ZW SWzSK/55OrvUA== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/4] replace per-quota region priorities histogram buffer with per-context one Date: Sun, 25 Aug 2024 21:23:19 -0700 Message-Id: <20240826042323.87025-1-sj@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 0009C1A0004 X-Stat-Signature: oqikqs3o5ymxmxc3jwxtj3ecu4b6qoks X-HE-Tag: 1724646740-502473 X-HE-Meta: U2FsdGVkX19LKfT/Cd472lFIRDIcd9F1wMCM41AsUTa3D/PtGcY3q38Alq+PZN0UUMLmww7hgH+doxpaVqxPiy1kLGZOI5HLIwyFsY73cDaEVtQ9qz0IgzqvAPHCwrSa29imxM9YyfUfLQIcCA3JS30Bn0r2IHCrrjbn/k7HBPr9MMHbBTpFrwVbC9UU18hS8xcLc1/G/AWhZdcmNEvQz882VIfFDifFmAhMIruguXbTH4ZWBwU2/i+W7Phmpf/AmupP51MBP85TIZIabvAoG0DYdqXH008GWN7a0lLJrexNH0DN+2BGii7l2j4Nw7Zq7cztlQBJXttIBpcmDr79WxrEntC6nUQJJnB4Vg2Oet+K3eWcIM68ixp86RHdbLVo4Mrdyz41LlnG6JKcBARTK73xkK7jnA5P99oMPBMEfF5ImGnno13JiaPSuvNoaqUSkD6wfbisdZYF+OUcClXBAZQaSrGOUYMht9Te5Ni/jl4vgpVuU5N/GIoAWFeHyttYlIyz9obPQ75j6L14Y6LJRw6hg895WxivBPeuW6pLxIMrdIakcgoFaiJwmwSQdQuFr72mCMvkGd7TZVafMbMstu/Qf6j9x/z1RqOBZWhnKh+NDwJ/f13SmEa3Cr+Yvqulx9WCceBRLhfdOe/l1+y62T9ZmlhSpuPjMTA38tKlbIWqD2H/aD7W1quX7zR2BV1qPiKoFKCmF3mtTRMCTQwda0ndiWl74KOuzQj9qCd+ga31dq5HOPqOu+yPaqnd8tpFDWUVKT5voxWR5To+qQdu+iys1L7ANTfPjDROEA7lD7lQ4VpvYQPyD0UjirmWE6XvWUoikRBjcn39lvh15IeB09qIN0tQ3nhwyw8CdtWXoY0PpYHxQ8bUx9q1cTCvcbKr8rQtUqqTR3wO9yWLymduCMYaxgiY0irzeNUvqX09k0tbT7WIhgXV1CAVSMTdsIfbEB8BKFesVrbN3l3I+8f 4mjbOL12 zVSt9NivvmQ+4hK0DbGxQzN4F5u611B8UvJ/KNjIB5d8qpAleJ+nJSiAW6k1l/y4SHyNjpjAmV0E4YFyS3ML6NiikOCQdBRLUeKk6PebiLDArLBHGbs4/QWOel242y06lwrwGDRE7P9XwIv0q23JyhVU2t9RwtK2hkRKX+JX5goLsItcr5KM4J5esIw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000434, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Each DAMOS quota (struct damos_quota) maintains a histogram for total regions size per its prioritization score. DAMOS calcultes minimum prioritization score of regions that are ok to apply the DAMOS action to while respecting the quota. The histogram is constructed only for the calculation of the minimum score in damos_adjust_quota() for each quota which called by kdamond_fn(). Hence, there is no real reason to have per-quota histogram. Only per-kdamond histogram is needed, since parallel kdamonds could have races otherwise. The current implementation is only wasting the memory, and can easily cause unintended stack usage[1]. So, introducing a per-kdamond histogram and replacing the per-quota one with it would be the right solution for the issue. However, supporting multiple DAMON contexts per kdamond is still an ongoing work[2] without a clear estimated time of arrival. Meanwhile, per-context histogram could be an effective and straightforward solution having no blocker. Let's fix the problem first in the way. SeongJae Park (4): mm/damon/core: intorduce per-context region priorities histogram buffer mm/damon/core: replace per-quota regions priority histogram buffer usage with per-context one mm/damon/core: remove per-scheme region priority histogram buffer Revert "mm/damon/lru_sort: adjust local variable to dynamic allocation" include/linux/damon.h | 3 ++- mm/damon/core.c | 14 +++++++++++--- mm/damon/lru_sort.c | 15 ++++----------- 3 files changed, 17 insertions(+), 15 deletions(-) base-commit: 9b7ae00cf6b2d882ac7062d1cf0f752933c8e461