From patchwork Wed Sep 11 05:13:30 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: 13799685 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 E6075EE0209 for ; Wed, 11 Sep 2024 05:13:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D44FA8D00F6; Wed, 11 Sep 2024 01:13:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CF56D8D0056; Wed, 11 Sep 2024 01:13:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BBD788D00F6; Wed, 11 Sep 2024 01:13:55 -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 9CD378D0056 for ; Wed, 11 Sep 2024 01:13:55 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 141FD41146 for ; Wed, 11 Sep 2024 05:13:55 +0000 (UTC) X-FDA: 82551290430.16.F23588F Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf26.hostedemail.com (Postfix) with ESMTP id 534B0140005 for ; Wed, 11 Sep 2024 05:13:53 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=1nxeDVLn; dkim=pass header.d=linutronix.de header.s=2020e header.b=0M+ZH50y; spf=pass (imf26.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=1726031529; 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=/qfn40Y/k109wQ4LtwO3H/8C6z24lcBDehQDK7V1Sj4=; b=HYgOxbl6c57L76l51s4Ldj2vPyL+dcTsz28CK7U+SzgUH6TUBrhHy/v4OfjFBogsh/XnPs CFo0nOS0xQWbM5jXjBtwyv7fv56VfYGNmZVfepKhNqhpx+J/p+t0nHaq4ZV5TD2MIR3FwA TAL65AgFz4Zl4vgaK8bi9OqFsVepuao= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1726031529; a=rsa-sha256; cv=none; b=apfrCvcwGsJ5kHT7MoksSfeEdve8jfO0W/iPEU/CPcX4D+EjDZbqO7h/Rekn5b3ITrwYIF HujAabBkqqkD2QKvDzIIIKqA8GPV6y3OxrQ3cEW9ok6B9vy1lCS4s2w7fukVQ6+9P/bC/U y1yJlYYi3AulW7W4d2Un1JBkqCPCQgg= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=1nxeDVLn; dkim=pass header.d=linutronix.de header.s=2020e header.b=0M+ZH50y; spf=pass (imf26.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 From: Anna-Maria Behnsen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1726031631; 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=/qfn40Y/k109wQ4LtwO3H/8C6z24lcBDehQDK7V1Sj4=; b=1nxeDVLnHU+gFSNUEpCjBMcbigE191YYo1hVm/7vNthUtyhXyqyzWFXRL+m/DdMs6dNR0w RbOOm30VlPab92EwXSMye5u8tE1gtoSOpBJm2RFl2WJKf7JEt5ofRd1MbitIDXQt4pRBwm RrFG6Vf7mNLFwLbkdK3uwJPX1p7CrTGTbpuoCIrFKe0j8lAhZQAXunfqosMlq/n/44MIxX DUV8m1eTPSpnrqriKO+YsLr/DOQ6sOE4DiNTyxnjoq2pc3cmd0MYVYxvbUsL13VJxk1hQD SdYE8p3ytNsQXGTbppzJBWZt7okvDiB9mesYvr0v76v98sHsAQay3C49L3lB9g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1726031631; 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=/qfn40Y/k109wQ4LtwO3H/8C6z24lcBDehQDK7V1Sj4=; b=0M+ZH50yw//HJTG8q9IdLUSDvkth/ozPO2TyySSGXJTqaBIKgSPIz8uv63Rzq2PA8umwvn 2mntOTl1vFQnJbBg== Date: Wed, 11 Sep 2024 07:13:30 +0200 Subject: [PATCH v2 04/15] timers: Rename usleep_idle_range() to usleep_range_idle() MIME-Version: 1.0 Message-Id: <20240911-devel-anna-maria-b4-timers-flseep-v2-4-b0d3f33ccfe0@linutronix.de> References: <20240911-devel-anna-maria-b4-timers-flseep-v2-0-b0d3f33ccfe0@linutronix.de> In-Reply-To: <20240911-devel-anna-maria-b4-timers-flseep-v2-0-b0d3f33ccfe0@linutronix.de> To: Frederic Weisbecker , Thomas Gleixner , Jonathan Corbet Cc: linux-kernel@vger.kernel.org, Len Brown , "Rafael J. Wysocki" , Anna-Maria Behnsen , Andrew Morton , damon@lists.linux.dev, linux-mm@kvack.org, SeongJae Park X-Stat-Signature: min8ykefxr6rehjerpgn66rhh3dp4ngy X-Rspamd-Queue-Id: 534B0140005 X-R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MKfu0V4B5hSiTNrOaAztTeqQANByXk5t3bA/yGWWu5VVGgZE98o+hckyNkXNwPwt7Z89E+k3t5+Mk+nQQxA+S7ranpBNY38OVWEtBOeUWrHLWpUqgQny0vKCyJKYcuDo09MX9gERADhSVw8kdwtFqhzMy6GRqfZVgSEn7aUf1DhaSBXxn8gdG06HISh/bKel1xqNjkPuQmgr/PaNxj45+2hlDICuFkSoQ3jJyA25lgSFeXH5j0xEXNkoWn+VBlpmabJStyChxdb8hAhm+tK8EBFATUHqONu0XNz9TF7K0rsW0Jk9SjD7FHyzjm1jOy/IZ 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: usleep_idle_range() is a variant of usleep_range(). Both are using usleep_range_state() as a base. To be able to find all the related functions in one go, rename it usleep_idle_range() to usleep_range_idle(). No functional change. 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 --- v2: Fix typos in commit message --- 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 11 05:13:34 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: 13799686 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 A15CCEE020A for ; Wed, 11 Sep 2024 05:13:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 110A28D00F7; Wed, 11 Sep 2024 01:13:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0C1B68D0056; Wed, 11 Sep 2024 01:13:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EC9AB8D00F7; Wed, 11 Sep 2024 01:13:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id C518D8D0056 for ; Wed, 11 Sep 2024 01:13:56 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 6D6D1A9D65 for ; Wed, 11 Sep 2024 05:13:56 +0000 (UTC) X-FDA: 82551290472.13.FD11B6D Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf18.hostedemail.com (Postfix) with ESMTP id B323C1C0007 for ; Wed, 11 Sep 2024 05:13:54 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=tZ7Jo8+P; dkim=pass header.d=linutronix.de header.s=2020e header.b=FLfAgtOq; dmarc=pass (policy=none) header.from=linutronix.de; 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1726031519; 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=z6vDQ8OrtE5tfTIWOA9AkJWnV/XdCc+NosMWCRhCJCs=; b=ao3YWibqZKwWaumEV8WKUS4pYEARpKfIakyVEoEmchip9so8tAMsFbjEUWpLHz10mfn40W HDqlpd5tIdaELAH+ukePXzYIGiCz8sWHBi1O3pyl/dLDDPnTPr/0VXng1/s/Ab4BML+Dv1 vDpDHg0HuX270GL0TlKwnkBmxnayd+s= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1726031519; a=rsa-sha256; cv=none; b=qUUBtZZIvTJjDsnuwp4kuKvBxt00NXN1XYIvbq99nDqeZpsSRnT/tJoT/pmjE876yXcGzJ LdSm0Ne7Vh4xUDRqhwnFgxwedBSY1EYDAV16ZmKXxA6+W+fAvjZ23P3GvEpgb8WKdOZQzT i4NE79H4DoJgoc2xPy9F+qlQNuOX60g= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=tZ7Jo8+P; dkim=pass header.d=linutronix.de header.s=2020e header.b=FLfAgtOq; dmarc=pass (policy=none) header.from=linutronix.de; 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 From: Anna-Maria Behnsen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1726031633; 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=z6vDQ8OrtE5tfTIWOA9AkJWnV/XdCc+NosMWCRhCJCs=; b=tZ7Jo8+P/9B40FBGihKmE6n5MfupBcXrXJ0RzEgsKoQ+IY09Fnp4IHAMQeJD2A2EPG0Dh8 ixHIMvr2nMXTiuFzRYuKAnyaF+mDTFQYcWZej6x2al+8hQwT701UWn+yk/G3vU9+G0038T NlfHzHhMaraRZgoNjRFbrByExUEdzjy72WHp61JD6tC4Tcnr+VtcLldy+czOmrvCeDRW7n L+yClvg23Cq3DUrsYlyzfqsA4OEQ2xu56oRfqp58gHzklFVBzm5n8o0Wj/hq/zNrheE2ZA GUFDMgUtZbGWsMpCiYhK0ODGPi2zpiTiRPWjNuXPWE//3hT7YQP2If0jtZmSMQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1726031633; 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=z6vDQ8OrtE5tfTIWOA9AkJWnV/XdCc+NosMWCRhCJCs=; b=FLfAgtOqurk66aa8g8iQTkdDuocQxfo8snrO0+LncEvZ+h8IjnLSVutdhxUA1cZoWccM7y sgFxwKMnEsrBA3Cw== Date: Wed, 11 Sep 2024 07:13:34 +0200 Subject: [PATCH v2 08/15] mm/damon/core: Use generic upper bound recommondation for usleep_range() MIME-Version: 1.0 Message-Id: <20240911-devel-anna-maria-b4-timers-flseep-v2-8-b0d3f33ccfe0@linutronix.de> References: <20240911-devel-anna-maria-b4-timers-flseep-v2-0-b0d3f33ccfe0@linutronix.de> In-Reply-To: <20240911-devel-anna-maria-b4-timers-flseep-v2-0-b0d3f33ccfe0@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: B323C1C0007 X-Stat-Signature: c3pmwykrnr9rgnd5xyoshn493qcakbst X-Rspam-User: X-HE-Tag: 1726031634-145826 X-HE-Meta: U2FsdGVkX19iypK82TysS6B5zhmmAP+m3uZ8Yu4xg2r/rtyoL1WZGZCvlEHKTjpwfL/Kyou9rvSP7mHoXbM4iH+2iQ/3hedtQ83WAyYC3SYwoBcTk7orU5Z3eoBjT6mN1REanuip91epTbMI7A1Uu9J0TS16bANuG4g9eoUYSsyl6VgLXgk8JoMU3Rry5wTefw54SfAwXzVyutCbYxaaALPGg/pgmdsFoc6V3EcY5LfyeKuNvb4Do4MY+8yXg0xBSsZrR+lFr97Li0BfX6niMe/aAuhKk0WV81H6LOyz4kYRh5B6WraqiHweSQt636y0euLXmm4z1bP+gKl8QnpgFQeSdLu0G438LCjpK7c0IazwxHu1920xc5kpOfbonU3/VMf+Ya5jqK1/qX523RBVV+f9p2l/G1SxY/g9G89Dcu0xYpQ6WJepYPxKwuMgNjaR1a9EvFR8wHkEUfGoAnmXK/M7ybqGPZ/qu+JvYeLwE3C0a7WQXq3vMYnci+1VvKPpYRwotbLHB/yrldWdmvnRTLfVh1I/X/j/bm1PlspIUxjsOKfwc+1R/XVeoJvduR84svZnO8DpBdikxi6OsANb8b/ewTuWtHlt7RTn5UNiJfnrforVzCM2EsRXkvqOaYsZj6Fl5p2QErmQI1nzwv63Gtmb2n6D+J6vFI3gYfK8brjH+xEn6EdmeZijkmFLUidhgOdy+rZHnNoGQ5xPfbkOTewEl+886uwG1jEsUi/ynJjr/2h4ow2dqbz0ncY9uOJ68acDNhYwlBiyJIWJMfvkzmTB1RwvL5Dx4QSQzH23PtXsRbr8QL7u4oA1B3PsRZs6b4Ww5xQjBFuGL3DDfrRRU9z/decvTJIC33wRqtHSOHCJKOE0O/iSfu6myK5WYCJlSMSMMGhH3BNajeZiYN4Y2EdL8DSTZfl7z+lo3EJch0EWNy6Qu+GG/0+OBit2mLJtIOEB2l/9b7b91/eNvNi HRDd9nnV 3ippVgReFVUU/tls4uUtsLMFPJwLu9MHzqWLdxk4TybsrYmvbaJda+mNRTBHeAmJTUjnvwSxiAooyy+os/enTnnvKeoqQktGwJ1byr8kvhDWXKFogjNwMF/NJyWVSuwRrT5k1MCSrGNB1tkHQaSctazlwXU2kboxPhMiuOimiyOPzzCqgRRioVbYtYVoc1od8ewAeArzM6Ipxo6Nf8c52flGJzgqHqRfoXYhNo0yNfLItvbJlCJmfalKGJmyaxwdcSKWBr0PN6YySLl85qIkfMOiOWqe7jgdaPN681d2j9WlR8E/DVhTELfFninyb5wTD9xTmmQeFJxIbzEM3Bv6BtV5qIfmeILuR7rni 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 Reviewed-by: Frederic Weisbecker --- 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);