From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8E2EA219A8B for ; Thu, 9 Jan 2025 13:15:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.60.130.6 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736428542; cv=none; b=R2kDTdz953VSJy1y6eqCzUpruQyyLcbbW6yQfOoMjeg2Uy7QYZewlz9uVk1uylS5LYajy+y1fR35wzhC9kdtxRMKuBh58USmxJZKfuzbo7oVYL5J4gNg9X4ygQCiHFxpReWrznoof2lgQH0eVIYE/9/B1jakfgY+GbccvdKKYCk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736428542; c=relaxed/simple; bh=3KWIG2mmKhaV/gJkcgP4kuB7LjMEjgZ5X9Pyt9i8Jhg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=I4Etn4zrABeL21kbDK/mneF/lLhfLAmBbZI4WKz4P7oHQcE1OyaeVn5OUGdLEI5rslwRkRRN56OXf2NYI4JwVTiNIZB+Xw7jFEpsSeTOkYcEF7KFjB+RSjwqU0xXGrsqV1mXZ+0l4aKk6RHTzH4BfsXHaPosDROtKGD3xF7EkCk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=RXHNAdf/; arc=none smtp.client-ip=178.60.130.6 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="RXHNAdf/" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=l78V4ESiWJCLASUcLE3njLXpFe+ymfOJGKR+C9fLFbw=; b=RXHNAdf/GpFCFejDid3S6ez4ov TxF44EF0GyENndLEl41Mu7gH53gBRgQpLLyGR++FwoKf1pNlocNJFvaNlboWeKtZPNJ5x8A9peyDD 8NsFi+uM6BgWdrsJZrq9GwowiRaemx6VZhEAPqh9FtlPEp7+tljT3T1UGtalKohKiBm9QzzcS3vLP J+FFQeLmnPFb7G2F38OiKpRasUc+h4go0sFMZiINgJlYtHjPYEMgyr7cwbNumhJug+evKDQLna2t5 YSqOVIuH9lmOX4RZPFCHYsFIbJdauffnFIVnPRjwq7I2kX7AzyzIU/qjW80TeRk1nOw+hYDLix3uO FsiKD4DQ==; Received: from [58.29.143.236] (helo=localhost) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1tVsNm-00DZAD-E7; Thu, 09 Jan 2025 14:15:31 +0100 From: Changwoo Min To: tj@kernel.org, void@manifault.com, arighi@nvidia.com, mingo@redhat.com, peterz@infradead.org Cc: kernel-dev@igalia.com, linux-kernel@vger.kernel.org, Changwoo Min Subject: [PATCH v8 5/6] sched_ext: Replace bpf_ktime_get_ns() to scx_bpf_now() Date: Thu, 9 Jan 2025 22:14:55 +0900 Message-ID: <20250109131456.7055-6-changwoo@igalia.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250109131456.7055-1-changwoo@igalia.com> References: <20250109131456.7055-1-changwoo@igalia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In the BPF schedulers that use bpf_ktime_get_ns() -- scx_central and scx_flatcg, replace bpf_ktime_get_ns() calls to scx_bpf_now(). Signed-off-by: Changwoo Min --- tools/sched_ext/scx_central.bpf.c | 4 ++-- tools/sched_ext/scx_flatcg.bpf.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/sched_ext/scx_central.bpf.c b/tools/sched_ext/scx_central.bpf.c index 2907df78241e..4239034ad593 100644 --- a/tools/sched_ext/scx_central.bpf.c +++ b/tools/sched_ext/scx_central.bpf.c @@ -245,7 +245,7 @@ void BPF_STRUCT_OPS(central_running, struct task_struct *p) s32 cpu = scx_bpf_task_cpu(p); u64 *started_at = ARRAY_ELEM_PTR(cpu_started_at, cpu, nr_cpu_ids); if (started_at) - *started_at = bpf_ktime_get_ns() ?: 1; /* 0 indicates idle */ + *started_at = scx_bpf_now() ?: 1; /* 0 indicates idle */ } void BPF_STRUCT_OPS(central_stopping, struct task_struct *p, bool runnable) @@ -258,7 +258,7 @@ void BPF_STRUCT_OPS(central_stopping, struct task_struct *p, bool runnable) static int central_timerfn(void *map, int *key, struct bpf_timer *timer) { - u64 now = bpf_ktime_get_ns(); + u64 now = scx_bpf_now(); u64 nr_to_kick = nr_queued; s32 i, curr_cpu; diff --git a/tools/sched_ext/scx_flatcg.bpf.c b/tools/sched_ext/scx_flatcg.bpf.c index 3dbfa82883be..5f588963fb2f 100644 --- a/tools/sched_ext/scx_flatcg.bpf.c +++ b/tools/sched_ext/scx_flatcg.bpf.c @@ -734,7 +734,7 @@ void BPF_STRUCT_OPS(fcg_dispatch, s32 cpu, struct task_struct *prev) struct fcg_cpu_ctx *cpuc; struct fcg_cgrp_ctx *cgc; struct cgroup *cgrp; - u64 now = bpf_ktime_get_ns(); + u64 now = scx_bpf_now(); bool picked_next = false; cpuc = find_cpu_ctx(); -- 2.47.1