[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250807121418.139765-3-zhangzihuan@kylinos.cn>
Date: Thu, 7 Aug 2025 20:14:11 +0800
From: Zihuan Zhang <zhangzihuan@...inos.cn>
To: "Rafael J . Wysocki" <rafael@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Oleg Nesterov <oleg@...hat.com>,
David Hildenbrand <david@...hat.com>,
Michal Hocko <mhocko@...e.com>,
Jonathan Corbet <corbet@....net>
Cc: Ingo Molnar <mingo@...hat.com>,
Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>,
Ben Segall <bsegall@...gle.com>,
Mel Gorman <mgorman@...e.de>,
Valentin Schneider <vschneid@...hat.com>,
len brown <len.brown@...el.com>,
pavel machek <pavel@...nel.org>,
Kees Cook <kees@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
"Liam R . Howlett" <Liam.Howlett@...cle.com>,
Vlastimil Babka <vbabka@...e.cz>,
Mike Rapoport <rppt@...nel.org>,
Suren Baghdasaryan <surenb@...gle.com>,
Catalin Marinas <catalin.marinas@....com>,
Nico Pache <npache@...hat.com>,
xu xin <xu.xin16@....com.cn>,
wangfushuai <wangfushuai@...du.com>,
Andrii Nakryiko <andrii@...nel.org>,
Christian Brauner <brauner@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Jeff Layton <jlayton@...nel.org>,
Al Viro <viro@...iv.linux.org.uk>,
Adrian Ratiu <adrian.ratiu@...labora.com>,
linux-pm@...r.kernel.org,
linux-mm@...ck.org,
linux-fsdevel@...r.kernel.org,
linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org,
Zihuan Zhang <zhangzihuan@...inos.cn>
Subject: [RFC PATCH v1 2/9] freezer: Introduce API to set per-task freeze priority
This patch introduces the basic API for setting freeze priority on a per-task basis.
The actual usage and policy for assigning specific priorities will be added in
subsequent patches.
This change lays the groundwork for implementing a more flexible and
dependency-aware freezer model.
Signed-off-by: Zihuan Zhang <zhangzihuan@...inos.cn>
---
include/linux/freezer.h | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index 6314f8b68035..f231a60c3120 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -46,6 +46,18 @@ static inline bool freezing(struct task_struct *p)
return false;
}
+static inline bool freeze_set_default_priority(struct task_struct *p, unsigned int prio)
+{
+ if ((p->flags & PF_KTHREAD) || prio > FREEZE_PRIORITY_NEVER)
+ return false;
+
+ p->freeze_priority = prio;
+
+ pr_debug("set default freeze priority for comm:%s pid:%d prio:%d\n",
+ p->comm, p->pid, p->freeze_priority);
+ return true;
+}
+
/* Takes and releases task alloc lock using task_lock() */
extern void __thaw_task(struct task_struct *t);
@@ -80,6 +92,7 @@ static inline bool cgroup_freezing(struct task_struct *task)
#else /* !CONFIG_FREEZER */
static inline bool frozen(struct task_struct *p) { return false; }
static inline bool freezing(struct task_struct *p) { return false; }
+static inline bool freeze_set_default_priority(struct task_struct *p, unsigned int prio) {}
static inline void __thaw_task(struct task_struct *t) {}
static inline bool __refrigerator(bool check_kthr_stop) { return false; }
--
2.25.1
Powered by blists - more mailing lists