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-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UtsLMFPJwLu9MHzqWLdxk4TybsrYmvbaJda+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);