From patchwork Mon May 27 23:45:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qais Yousef X-Patchwork-Id: 13675937 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 A6880C25B7C for ; Mon, 27 May 2024 23:45:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B833C6B008C; Mon, 27 May 2024 19:45:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B0AE96B0093; Mon, 27 May 2024 19:45:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 95ED46B0095; Mon, 27 May 2024 19:45:24 -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 7808D6B008C for ; Mon, 27 May 2024 19:45:24 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id F36B51206A9 for ; Mon, 27 May 2024 23:45:23 +0000 (UTC) X-FDA: 82165809726.01.1BA335A Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) by imf13.hostedemail.com (Postfix) with ESMTP id 2C76B20006 for ; Mon, 27 May 2024 23:45:21 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=layalina-io.20230601.gappssmtp.com header.s=20230601 header.b=E+orh2a1; spf=pass (imf13.hostedemail.com: domain of qyousef@layalina.io designates 209.85.128.46 as permitted sender) smtp.mailfrom=qyousef@layalina.io; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1716853522; 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:in-reply-to:references:references:dkim-signature; bh=LabiRKd6+Fdc1S9teFQ4XXd5rRTCMDgsFOfIBlpIeJQ=; b=7+7LUtKdwGjxI8D3MHkU+eH0OxpXS1vXAhyADWxjUe/hnDrJ77ZN+qorNyuwYniJstuJsr dtxbitTCiTYiJd1N4ZrVQKrMhOSfMD9zgRV6b8uWwIc3HJUuUCyoQ1REyua42A4PhmzOKm 3dzaGcp0qHrj2uuvEnjrId2h7jUOwMc= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=layalina-io.20230601.gappssmtp.com header.s=20230601 header.b=E+orh2a1; spf=pass (imf13.hostedemail.com: domain of qyousef@layalina.io designates 209.85.128.46 as permitted sender) smtp.mailfrom=qyousef@layalina.io; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1716853522; a=rsa-sha256; cv=none; b=TSlCby4OCx87OuZyO7AD14pc0XegUbfLXpzQ9safTpcxtJ/Yu59uKHQY0VCOMzns7XLLZC Xflp61Gl+RdXjXIS6C3oABG2+h/eBSO8igiyxBNywrJy53XoFqQ19kkMAxu5Jrj6cfgG6w p4AvnZ2cesycqr4OTThwOCI4WlrCx1o= Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-4210aa012e5so1613115e9.0 for ; Mon, 27 May 2024 16:45:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=layalina-io.20230601.gappssmtp.com; s=20230601; t=1716853520; x=1717458320; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LabiRKd6+Fdc1S9teFQ4XXd5rRTCMDgsFOfIBlpIeJQ=; b=E+orh2a1P6OkpDjMtxpPnZVG9L5Xvn9ZFbe7aT6ZrjHZ2cDiomzcb6c5gRSB6EHu8z rPJBnDu6Bb9jrCSSeaJDj3hqhZ4NfvtNzSCNH3uCWlY9Qw4l92cE8/6fLSZAd3uL7eKk obG3iPX3vdpEXnyl9wEK1K5DF1UMe5MSDNF7QXQYM+irf7mFaTkw4ntBPGLDRwAL75i3 vIODDY/iSqDWCL3LQHTETHoYoNpOChiKoOasvuM9k26VBpP8wFHYYa161t6SlDgHm/Gn jNJ3kgkw5m6IQF/YYEAqIw5HV/Kn8BKZt1V7uaBhFdwZnQcv6uF1b/RePA1pCQWuSvAe WH6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716853520; x=1717458320; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LabiRKd6+Fdc1S9teFQ4XXd5rRTCMDgsFOfIBlpIeJQ=; b=hUSXY3Gc7+AZ3RkwMz4RGvLppFi9s3X+Cca97cp1p4zw6TGCtX0PcK8JNqsIYgoTZv 9kE8Zc2x/09yNyattettfAQvEkiqn34f9inJYE0lD8Yc5+OJN0PksS3WAZSLmU4oUeoW 1xXosXpcK+lE9RXYhIOVoTCUFFqrfnF9kfklebVFN9gzYX8+Z+5pQWj/ipmQhIx56VCP lMsrvVGLuu4w5u/nD4JVOW0ENEqMi41mxRT54a+7hdygZlKha4Iilc08EhfpOB3RmvC/ UQHfqHtL0KAswHpDRfHmWITTow+n5+ofFdWDDp7qwCIUKdIeuQHu1fBaCNGqtub01KWU J7lw== X-Forwarded-Encrypted: i=1; AJvYcCXpNbzeRAskHTTys2PF/huut/WDv5nVHyKSk4PYuFfGHNllpQvVNWMZq+t+OE04rwgjERmsQ17H8E3uT8eR3WsiYz4= X-Gm-Message-State: AOJu0Yx7OuvIOC948678w/PBno+7b8HJV8iR4bXSkSwZdnkEg37hZrfY IIU1ExwI9p1rGwarjkXsXGwBDNHGXk4Q+wFlkgWZRshNoaLK0AbfVCXeIQIxk/E= X-Google-Smtp-Source: AGHT+IGy/gagOKc04QMh7vQyWY1fx5jjEL/7vEbfZ1S7DNLjj4/0M9wIHpNhOOn/pNT8THqBrympIA== X-Received: by 2002:a05:600c:3ca5:b0:41a:b54a:9ad8 with SMTP id 5b1f17b1804b1-421089fa29dmr70623995e9.0.1716853520726; Mon, 27 May 2024 16:45:20 -0700 (PDT) Received: from airbuntu.. (host81-157-90-255.range81-157.btcentralplus.com. [81.157.90.255]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42108970967sm123535515e9.17.2024.05.27.16.45.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 16:45:20 -0700 (PDT) From: Qais Yousef To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Steven Rostedt Cc: Vincent Guittot , Daniel Bristot de Oliveira , Thomas Gleixner , Sebastian Andrzej Siewior , Alexander Viro , Christian Brauner , Andrew Morton , Jens Axboe , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-mm@kvack.org, Qais Yousef Subject: [PATCH v3 2/3] hrtimer: Convert realtime_task() to realtime_task_policy() Date: Tue, 28 May 2024 00:45:07 +0100 Message-Id: <20240527234508.1062360-3-qyousef@layalina.io> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240527234508.1062360-1-qyousef@layalina.io> References: <20240527234508.1062360-1-qyousef@layalina.io> MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 2C76B20006 X-Stat-Signature: c7hheb4zbjwsu3yhzx7mmnfxtsn41se6 X-Rspam-User: X-HE-Tag: 1716853521-812568 X-HE-Meta: U2FsdGVkX19KL0H4O5utu+jQJTAKeoNa3eZrvdDLn42THr8sbHvD6whYU8URMZek9zleKdwBPSjjxuURy0jpQ3wQpbBDq1TECXHZM0NSWGNS0dgVBaE3FigMC3NeZPK0l9xrkwpycugPh0y7o/D9jo5AU4UdyJQ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OPwkhQIg1mN5MX3NNx1egoGm94IC7/2gRk4ar38oSALVyawYLijWzARLIfw7g/Wmjp6h5P3CEvBGFdfLWKtEP7m/D4RWR2Hjn0bSlTEVpTIQI1B0C3oBawuy1MxH1C4LYshqlxAiZWbUU+Af/URxsB4IlFPT9+7QNSQsL8hEDsnRFJxmRWONXqkGuBsC0byhqjXqxeKWKiyK/f0Asy2NEFvDg2r7NkOOgzZU+2qkNHel/faO/93uZ1GQnWZuKH/JOvXRO4Q= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000090, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: As Sebastian explained in [1], We need only look at the policy to decide if we need to remove the slack because PI-boosted tasks should not sleep. [1] https://lore.kernel.org/lkml/20240521110035.KRIwllGe@linutronix.de/ Suggested-by: Sebastian Andrzej Siewior Signed-off-by: Qais Yousef --- kernel/time/hrtimer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index 89d4da59059d..36086ab46d08 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -2073,7 +2073,7 @@ long hrtimer_nanosleep(ktime_t rqtp, const enum hrtimer_mode mode, u64 slack; slack = current->timer_slack_ns; - if (realtime_task(current)) + if (realtime_task_policy(current)) slack = 0; hrtimer_init_sleeper_on_stack(&t, clockid, mode); @@ -2278,7 +2278,7 @@ schedule_hrtimeout_range_clock(ktime_t *expires, u64 delta, * Override any slack passed by the user if under * rt contraints. */ - if (realtime_task(current)) + if (realtime_task_policy(current)) delta = 0; hrtimer_init_sleeper_on_stack(&t, clock_id, mode);