From patchwork Wed Sep 4 13:04:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna-Maria Behnsen X-Patchwork-Id: 13790828 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 89C54CD3431 for ; Wed, 4 Sep 2024 13:05:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A12266B02DE; Wed, 4 Sep 2024 09:05:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 999D56B02E3; Wed, 4 Sep 2024 09:05:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7E9C26B02E0; Wed, 4 Sep 2024 09:05:38 -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 5305A6B02D8 for ; Wed, 4 Sep 2024 09:05:38 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id EA6BE80FD6 for ; Wed, 4 Sep 2024 13:05:37 +0000 (UTC) X-FDA: 82527077514.03.BF2466A Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf18.hostedemail.com (Postfix) with ESMTP id 1A9C11C002E for ; Wed, 4 Sep 2024 13:05:35 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=K1fHHPDD; dkim=pass header.d=linutronix.de header.s=2020e header.b=VmFDXr0l; spf=pass (imf18.hostedemail.com: domain of anna-maria@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=anna-maria@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725455088; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=R6JzfinROxb0cF6NxXq0JcmrJuw7pVBPvlFaejLfwHs=; b=h++gqFBScnFNPgr2mMqEsEZKkVP2bqL8aV1s3wGJlQJQx6dv2Dadwn6dYO/YwzjjNouUtu fkavU88BdP08+sGwDa7jTvFk4b7+mzI1mTRM0L4wnb2F1Z5uPzHDENkev5gH+Nh+y8Z9ar 3cDLqqe8aFcBS5P8kWqLeU046ZbU9Bw= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=K1fHHPDD; dkim=pass header.d=linutronix.de header.s=2020e header.b=VmFDXr0l; spf=pass (imf18.hostedemail.com: domain of anna-maria@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=anna-maria@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725455088; a=rsa-sha256; cv=none; b=rXkrNp0eCgOdBBs0ONLI/B189XtDe3YTHrEhHaGNuvhwYmmdfWUTDjsYKxnkP/5UEo2XkJ MeYJuLxbgaeMfCq0Qh168vb+p9pQqVzyYJFtFAJ6/gEhtWUBqkQEbpgn6aJ9Reo2EZwc9h h+OCF9F03KJUGeo1ADxZpjgddxr8wvg= From: Anna-Maria Behnsen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1725455134; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=R6JzfinROxb0cF6NxXq0JcmrJuw7pVBPvlFaejLfwHs=; b=K1fHHPDD27YunAkdxRxKlxq7v0mgwE/YXfmGTccsLisSDbEUJP5ilOZ/AOSa8xlcm5JLZE ZLWQ2TfNLuirTGa9IWwYtePyYKOwoh++7/zmmWgD9ivb5c6RTvf0wOlpX/GKY13Kyl0seU BImyKU9xR37tQ82WpC1Zow2CrcJo9KJL+z4IGxHDGV8G2w/NdFm3/qMJ1UGSvJR679MCTo 7uGRz3apBsEUNJlIXVAWnn5SbZqusjwabJCNmzHHcguNXR0AJ0mYyMzbZujKiKu1gne04r z8YFjvYcwCf2Qn2DLHU6hIqDJis0IaNf+iV5b2HHROWjLZmmKN+TEFlDvjQeLg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1725455134; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=R6JzfinROxb0cF6NxXq0JcmrJuw7pVBPvlFaejLfwHs=; b=VmFDXr0lbLciL542cJmYJCDZ6Oumihap+7q+8O9BQBdroT1ZJJulw0rGnYOb5gGnS5egov SD8iMVd4PfPjvBBQ== Date: Wed, 04 Sep 2024 15:04:55 +0200 Subject: [PATCH 05/15] timers: Rename sleep_idle_range() to sleep_range_idle() MIME-Version: 1.0 Message-Id: <20240904-devel-anna-maria-b4-timers-flseep-v1-5-e98760256370@linutronix.de> References: <20240904-devel-anna-maria-b4-timers-flseep-v1-0-e98760256370@linutronix.de> In-Reply-To: <20240904-devel-anna-maria-b4-timers-flseep-v1-0-e98760256370@linutronix.de> To: Frederic Weisbecker , Thomas Gleixner , Jonathan Corbet Cc: linux-kernel@vger.kernel.org, Len Brown , "Rafael J. Wysocki" , Anna-Maria Behnsen , SeongJae Park , Andrew Morton , damon@lists.linux.dev, linux-mm@kvack.org X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 1A9C11C002E X-Stat-Signature: y8miwew667b5yct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AKjUs9Ek/GUwQAJ+TXp+fQuv6wZ70q8PZDBglbDQ8hKowIJAghnBPsUXsAvMxiRTfvcNpHzw4cfrF8eCBaHTSm+oQHGbQCxEchixC4V6aE+QLXmXXF//b6nBP8uSDl25kQosFXr6XofFlkOpNSSsbxYLr7X759OEGn7UbksOs8twZQDkn3FDQsfDLx4RQFdUYXM40UxvSr2uSjax0nHEX7VmQFio8PfeeFvVihGyuZtrpZNxHeV7lTOfiLtwU0atVeJjzS3f/f1WbVRqI0c4UxXfgX 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: sleep_idle_range() is a variant of sleep_range(). Both are using sleep_range_state() as a base. To be able to find all the related functions in one go, rename it sleep_idle_range() to sleep_range_idle(). No functional change. Cc: SeongJae Park Cc: Andrew Morton Cc: damon@lists.linux.dev Cc: linux-mm@kvack.org Signed-off-by: Anna-Maria Behnsen Reviewed-by: Frederic Weisbecker Reviewed-by: SeongJae Park --- include/linux/delay.h | 2 +- mm/damon/core.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/delay.h b/include/linux/delay.h index ff9cda975e30..2bc586aa2068 100644 --- a/include/linux/delay.h +++ b/include/linux/delay.h @@ -68,7 +68,7 @@ static inline void usleep_range(unsigned long min, unsigned long max) usleep_range_state(min, max, TASK_UNINTERRUPTIBLE); } -static inline void usleep_idle_range(unsigned long min, unsigned long max) +static inline void usleep_range_idle(unsigned long min, unsigned long max) { usleep_range_state(min, max, TASK_IDLE); } diff --git a/mm/damon/core.c b/mm/damon/core.c index 7a87628b76ab..94fe2f1f9b0e 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -1887,7 +1887,7 @@ static void kdamond_usleep(unsigned long usecs) if (usecs > 20 * USEC_PER_MSEC) schedule_timeout_idle(usecs_to_jiffies(usecs)); else - usleep_idle_range(usecs, usecs + 1); + usleep_range_idle(usecs, usecs + 1); } /* Returns negative error code if it's not activated but should return */ From patchwork Wed Sep 4 13:04:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna-Maria Behnsen X-Patchwork-Id: 13790829 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 56D87CD3431 for ; Wed, 4 Sep 2024 13:05:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 921F28D0257; Wed, 4 Sep 2024 09:05:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8D2F78D0253; Wed, 4 Sep 2024 09:05:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7030E8D0257; Wed, 4 Sep 2024 09:05:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 3D53B8D0253 for ; Wed, 4 Sep 2024 09:05:40 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id DACB7A0C0B for ; Wed, 4 Sep 2024 13:05:39 +0000 (UTC) X-FDA: 82527077598.05.C84AF36 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf21.hostedemail.com (Postfix) with ESMTP id 1036A1C0030 for ; Wed, 4 Sep 2024 13:05:37 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=nE7oMldu; dkim=pass header.d=linutronix.de header.s=2020e header.b=JVYH5NQQ; dmarc=pass (policy=none) header.from=linutronix.de; spf=pass (imf21.hostedemail.com: domain of anna-maria@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=anna-maria@linutronix.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725455031; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=rtNvbsuelbk0+4PJUSwQ16v3Vz38xbL3/UvjLhGlwIk=; b=ZV7vU8CaGrzk7ibjSLftAbjP+jP3uJUo9g47lpzg+z0C1p5Hp2b+WcHR0o3xmXvMQd4c3b fpHvWUJ7JV3umY5yu0nSu1Fmr2Kydhkeik4KEjKXY8hiBGPyOD3vzpQUgTM+1xpF8V7VR8 PwxmQN6b+/PV+FItLp0ORDiygjbuhZI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725455031; a=rsa-sha256; cv=none; b=BiAbE9pY1QhuxtoV7B9TA8fue4bz0mJ0hKJeUJZht0viAD769iz57Y7+4FCSgpr1fIKauk OiBfLtzV/JT+JkdgRVwctNHyKbE62P3dk+Ln3ISbmqZtiwa9WwVr/vtTun/7yZHmkMKitY pbUwonL6n2+FvLgPg4MZYYNKrlPsc7Q= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=nE7oMldu; dkim=pass header.d=linutronix.de header.s=2020e header.b=JVYH5NQQ; dmarc=pass (policy=none) header.from=linutronix.de; spf=pass (imf21.hostedemail.com: domain of anna-maria@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=anna-maria@linutronix.de From: Anna-Maria Behnsen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1725455136; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rtNvbsuelbk0+4PJUSwQ16v3Vz38xbL3/UvjLhGlwIk=; b=nE7oMldu2nWfetQ+sxMrs/59NURPzMfcqI3TaZ7BL7TGcn1MzXkvp3kTGSYEkf3siHecZV cf43vfqI50vDV/+IWPmgXM6/1Ltpv3826dY2v06JY1bYmnV1ljagxhUaItdPsDZFZJzlQc QZ3ri72YT0SMEPnvzfQEM/gGLGZBwvFWhGTpOCMjTQBVEPeEdBTKtATs7/c/bWs3ZFltaS vdWZlR6EMkkksHLeGBu1xMiYQQpeWdT86s55dmundWoar6z9Uj4ojDZKNDjmJiBGoKB/xn W96AK58tL7f3xkqd6DQZxXtFK/e1NdsdDK5Ymy+dZZ5UCC1tYePYjdPRxQTXYw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1725455136; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rtNvbsuelbk0+4PJUSwQ16v3Vz38xbL3/UvjLhGlwIk=; b=JVYH5NQQLMH5sMCQbT+2vpj1ZKtkXWgS5nGPCOxg/Qua+HONrSXt1Q4ONon4fpKmK1kuRX HSgSgbVT/mSS56CQ== Date: Wed, 04 Sep 2024 15:04:58 +0200 Subject: [PATCH 08/15] mm/damon/core: Use generic upper bound recommondation for usleep_range() MIME-Version: 1.0 Message-Id: <20240904-devel-anna-maria-b4-timers-flseep-v1-8-e98760256370@linutronix.de> References: <20240904-devel-anna-maria-b4-timers-flseep-v1-0-e98760256370@linutronix.de> In-Reply-To: <20240904-devel-anna-maria-b4-timers-flseep-v1-0-e98760256370@linutronix.de> To: Frederic Weisbecker , Thomas Gleixner , Jonathan Corbet Cc: linux-kernel@vger.kernel.org, Len Brown , "Rafael J. Wysocki" , Anna-Maria Behnsen , SeongJae Park , Andrew Morton , damon@lists.linux.dev, linux-mm@kvack.org X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 1036A1C0030 X-Stat-Signature: y37usgcxce9dm4bmzbb1xnqiw359i5te X-Rspam-User: X-HE-Tag: 1725455137-833575 X-HE-Meta: U2FsdGVkX19BdykfK6USxbYJDEEknj7alNTVt4UFt94tYd4P3rlBimhvZcjrNyycNhc1VzH+naXjDgmRvNzJQ7yvyNyQUt0HCm+gWHDY7ihcnt5xzB/g5W/R+YgQDpDZlSfOQcIniFUqdMghFcwcbJgrgXV1jrbKHA62fU05Zp4u2/HwMgSLKkAQWTAfsU8tyUzLHEf3zt4UOxZl4AVR9RifuBx3807nyNV8WxU+Xx8xY7iI0patVqa6TCINqqKQVWLonygboa5D53YEgPEVXKS+Vdr4XhVZrGh9NTTsTP/3otKDQvowEYRl6LswFjYo+uFxwuFQNAkAM2XvYaTc9+GercfsA5vBerujjp7Ikz92tJAxZN1HUgteHG6RiKUnFPXses3E4mpuPTCTH4hK+2/p4t7Kb7m1HEoojmKc+4hCpqgS250vUUTKVL/RdAGJKAZQERX1EUDnLtcXU5Zy2/p1+circ1ffPmp7jmWNpbzamr0r3HctvXm6nOoVuQWJm31RuwcXYglIqR+CjH9oys8ZjTcXjbMySFBpeokOzHMnZ/YvUE3sQitaICG5V/Q3wx+Jc6KzIo0Se67gQ1YQDcs+Vy0BzMsbQ4QeaN04NyegP+4UmhYWZ9NwUomfjZXT1TK0cCsfOCbq3ons4WestRuB3k+Z/9GuS31JRIbrwfiiXZ1wDo6MObhyxl/mk3gLCZvr6QCV6NFAarXDmeObjDL+JEVfncgg/jP06/j8ZGz3UwLLWfPAJaWWrDvn39KClWum5zTecJUM+RDSEPZbCThRbuyuHVPXxmDNYQsdErzoepR4gD63rC/tpeEK7RsykkClkrpzp/41YH1OVV6AvAEb8pyAro14gQJ3idHic2zdyhGFumTDVLzSw4KQXsCA5AUmsYeZWRPbIaaiAy9R36YWo1rCZXxa82nkoSkWUPgUdYoOzVZYYnm0UqbecoGV4AlZY9A8e27EDFh4+ak jxseeINM Mg+llgJtJ6P1S3h/fWCoJFby4tXeWtXRGduP11R61ZpgFfBQAAkJFRCa/BErCi6A9doXo6WK7an9vCrNIXsDGsoPkG//4+hEVp0fbQ17jVZ9VRxVn5DB6EW8QSpF5jp6PsKBiZnQY6IcF12WNGYQ+pmaHRp2OwR2C7Vkej1fHK0C2+2V3EUF7zCKQhszi+SZ5TeJP9d31M21dhN7CqC6es+ygtF/4fxlEDQm5un9wuEbbHkIViV5+ROk6F/8g4UvU6qtfkfLy/K8waQuNglynbRuAqlXYkK8A+WEPzdESr6S4b0977HjLLm3kYYqaG7YU8jszelMBwjwz1YYswzDwsMhb+x5bZZjFgsSy 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: The upper bound for usleep_range_idle() was taken from the outdated documentation. As a recommondation for the upper bound of usleep_range() depends on HZ configuration it is not possible to hard code it. Use the define "USLEEP_RANGE_UPPER_BOUND" instead. Cc: SeongJae Park Cc: Andrew Morton Cc: damon@lists.linux.dev Cc: linux-mm@kvack.org Signed-off-by: Anna-Maria Behnsen Reviewed-by: SeongJae Park --- mm/damon/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mm/damon/core.c b/mm/damon/core.c index 94fe2f1f9b0e..4b971871da75 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -1883,8 +1883,7 @@ static unsigned long damos_wmark_wait_us(struct damos *scheme) static void kdamond_usleep(unsigned long usecs) { - /* See Documentation/timers/timers-howto.rst for the thresholds */ - if (usecs > 20 * USEC_PER_MSEC) + if (usecs >= USLEEP_RANGE_UPPER_BOUND) schedule_timeout_idle(usecs_to_jiffies(usecs)); else usleep_range_idle(usecs, usecs + 1);