From nobody Mon Feb 9 23:42:55 2026 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4EA4A19FA9D for ; Fri, 20 Dec 2024 06:20:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734675642; cv=none; b=h6BzSxchGXRsrJ0NsGD646j9vhqYBwXxV9eeleXRzhI/44Tv3sto/gcaGIomChAHwAuYC9jX6tVTSiElClv4npva0feNb18soOpaQHfzVeWbswziYF1gsqU4yUWKm4yx/19lmW8Na9v3YudjG5EuanS0ZyJkg9qy+26d3TsLs8g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734675642; c=relaxed/simple; bh=GZDtGSP3knc4XfhDJndoAF3aAtv9DQSb0onbM9mot6Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BRYRvNL9OFRAtTitLU9TnOFL6pc01iQkLwkbH+WQdNshNzu+K8Bdy6kFZu0oDvjv89EdpqzZH7CZrMEkKb4SH5hh6Y0x3qjs7AdzWCuaH5g5aetJrio33pRI6D1SFWaQagf3ftMBChXbw4dXm9/2uOFTIKNvr97DcTcAX74iFUA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=R+mBbBRe; arc=none smtp.client-ip=209.85.216.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="R+mBbBRe" Received: by mail-pj1-f53.google.com with SMTP id 98e67ed59e1d1-2ee50ffcf14so2171536a91.0 for ; Thu, 19 Dec 2024 22:20:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734675640; x=1735280440; darn=vger.kernel.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=3qwdnhpnNZ/kDLebmCqGGOAqoWdsfoXXWVd5XUHDoNY=; b=R+mBbBRer0T8WdBX23NtDjdIBhrHwpleN8dFThiztMyBWC8fylyf93EKTxsoJZjvZN BwbyCl1rHHO1OimK+MYZcB3HKieuMDAV6uoPjZOhQdgVppHfT6qqDaTmGeVFhbRVp9yE YH4tclYHZj1ic91ggtk/SGEtEfYLMkEuk7a7xyvxUnbW8F4uqJLE11L32qwP/nCjypAp stC7aefcDaE4FddpvlYxBKrSnnSvsyAd7wAL7uJ/N3jqaimoFs2x8WSyrqhppXjk2auc vfyqeAjppA+h8OM8ZD11JomgAoz51d1upA7H6Y7E1UYdT5vq72q6IJBM5d1Maiftq9tK rFTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734675640; x=1735280440; 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=3qwdnhpnNZ/kDLebmCqGGOAqoWdsfoXXWVd5XUHDoNY=; b=WFkrBI4BlCOsIsOtW/RU50ZhZfYYhhz4yLrwZWBTv2G+amalYzkbpM4XC8WCIOOu1H ECFEVziAGCckgi8K92Bku5VmVZcUkKNvueg6WTDDjh91xHo7AQK92iAjymPRw77ZaNYR p9bjRyvq9C4X1DIVst3twsDZeJBrixwYJsXwu9nfDyiIiCujve9ETMiJ6Zc/2MFGfEIP 0A+hztMjnaEbGVRHZzxVHgO97GKbu/7oOHpS/m/7piNj9udua3krRwBSeJirQRjpufju 62xYyD+eu1uIUk9qsc8xgLwwMrP51kjbB2VzXJ1oGIgEgy5JCQBIfRIC8vE+2HdFCut2 Fn7Q== X-Forwarded-Encrypted: i=1; AJvYcCU/oVxtbN0RCY3fnb6Z8oN+lQ3XP+hLZ8+n0Niqme1PqThinSHzuvsIIHTLPylgL55eDdYt9oqBQMVhGbo=@vger.kernel.org X-Gm-Message-State: AOJu0YwRvlbwm4QU2duAwJwn+dq3Z7A4RAnUkbrUcMnYYom+crf3gfQ+ U8GcsTMOdz2qEHMfhnqHjPYTSLIQCsRkeAJgRS3MzYXhRjS72AkaInsndg== X-Gm-Gg: ASbGncu7OxswgB2BFkBy7joXSSJ4xT9tAZU7jFHAGqkY/M0SMfaHdLp3IFHsaxgFICV 2UMI9bwbqX9JS4CV5OwDP2frf4Z7gFMuL6ZISZa6cWrKdtVZGbUTKEzgqxWmm4z4Bu1+6vmlgg+ DaMqbfSwZ3L5pZpjFK89oaQrV3ZWfvrexz5dI3ccF8I8HEt4arJDuSyIivSACJfCWnkOiPm0e1j /dwMr1C7AKbqNkuGymt6B3HdMsRsDk4qStyVkDPasDd/bZxdoK1e1U9p6SetBwy7vH0dInzyr0l JaAN9uSuvSjS X-Google-Smtp-Source: AGHT+IE9trKwnu2T1nHGleo7LJX45/FVjHYPX1YK5kl+fqFFmdPFZykZxfq0SULE2I1wifivu9mfiA== X-Received: by 2002:a17:90b:2d4e:b0:2ea:61c4:a443 with SMTP id 98e67ed59e1d1-2f44353f053mr9242355a91.4.1734675640530; Thu, 19 Dec 2024 22:20:40 -0800 (PST) Received: from localhost ([58.29.143.236]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dca02f8asm21963655ad.279.2024.12.19.22.20.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2024 22:20:40 -0800 (PST) From: Changwoo Min X-Google-Original-From: Changwoo Min To: tj@kernel.org, void@manifault.com, arighi@nvidia.com, mingo@redhat.com, peterz@infradead.org Cc: changwoo@igalia.com, kernel-dev@igalia.com, linux-kernel@vger.kernel.org Subject: [PATCH v6 3/6] sched_ext: Add scx_bpf_now_ns() for BPF scheduler Date: Fri, 20 Dec 2024 15:20:22 +0900 Message-ID: <20241220062025.27724-4-changwoo@igalia.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241220062025.27724-1-changwoo@igalia.com> References: <20241220062025.27724-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: quoted-printable Content-Type: text/plain; charset="utf-8" scx_bpf_now_ns() is added to the header files so the BPF scheduler can use it. Signed-off-by: Changwoo Min --- tools/sched_ext/include/scx/common.bpf.h | 1 + tools/sched_ext/include/scx/compat.bpf.h | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/tools/sched_ext/include/scx/common.bpf.h b/tools/sched_ext/inc= lude/scx/common.bpf.h index 858ba1f438f6..79f0798a5350 100644 --- a/tools/sched_ext/include/scx/common.bpf.h +++ b/tools/sched_ext/include/scx/common.bpf.h @@ -76,6 +76,7 @@ bool scx_bpf_task_running(const struct task_struct *p) __= ksym; s32 scx_bpf_task_cpu(const struct task_struct *p) __ksym; struct rq *scx_bpf_cpu_rq(s32 cpu) __ksym; struct cgroup *scx_bpf_task_cgroup(struct task_struct *p) __ksym __weak; +u64 scx_bpf_now_ns(void) __ksym __weak; =20 /* * Use the following as @it__iter when calling scx_bpf_dsq_move[_vtime]() = from diff --git a/tools/sched_ext/include/scx/compat.bpf.h b/tools/sched_ext/inc= lude/scx/compat.bpf.h index d56520100a26..2f16f30ae741 100644 --- a/tools/sched_ext/include/scx/compat.bpf.h +++ b/tools/sched_ext/include/scx/compat.bpf.h @@ -125,6 +125,11 @@ bool scx_bpf_dispatch_vtime_from_dsq___compat(struct b= pf_iter_scx_dsq *it__iter, false; \ }) =20 +#define scx_bpf_now_ns() \ + (bpf_ksym_exists(scx_bpf_now_ns) ? \ + scx_bpf_now_ns() : \ + bpf_ktime_get_ns()) + /* * Define sched_ext_ops. This may be expanded to define multiple variants = for * backward compatibility. See compat.h::SCX_OPS_LOAD/ATTACH(). --=20 2.47.1