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: y37usgcxce9dm4b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Ca/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);