The commit is pushed to "branch-rh10-6.12.0-55.13.1.2.x.vz10-ovz" and will 
appear at [email protected]:openvz/vzkernel.git
after rh10-6.12.0-55.13.1.2.21.vz10
------>
commit 051c7f2f36453da543364b4135f241ecf168e09b
Author: Pavel Tikhomirov <[email protected]>
Date:   Mon Nov 24 19:20:46 2025 +0800

    ve: Add ve namespace based task_ve() and get_task_ve() helpers
    
    Those will replace task->task_ve references.
    
    We protect access to other task's task_ve with task_lock. To actually be
    able to dereference ve fields we also have to take reference on it,
    because other task's task_ve can change under us.
    
    If we don't plan to dereference ve and only use it to compare with other
    ve, we can just read it without any locking.
    
    https://virtuozzo.atlassian.net/browse/VSTOR-118289
    Signed-off-by: Pavel Tikhomirov <[email protected]>
    
    Feature: ve: ve generic structures
    ======
    Patchset description:
    ve: Add VE namespace
    
    Main ideas behind VE namespace explained in "ve: Introduce VE
    namespace".
---
 include/linux/ve.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/include/linux/ve.h b/include/linux/ve.h
index 63b80068e2fb5..f664740041001 100644
--- a/include/linux/ve.h
+++ b/include/linux/ve.h
@@ -179,6 +179,17 @@ void cgroot_ve_cleanup_ra_data(struct cgroup_root *cgroot);
 extern struct ve_struct *get_ve(struct ve_struct *ve);
 extern void put_ve(struct ve_struct *ve);
 
+static inline struct ve_struct *task_ve(struct task_struct *task)
+{
+       return READ_ONCE(task->task_ve);
+}
+
+static inline struct ve_struct *get_task_ve(struct task_struct *task)
+{
+       guard(task_lock)(task);
+       return get_ve(task_ve(task));
+}
+
 void ve_stop_ns(struct pid_namespace *ns);
 void ve_exit_ns(struct pid_namespace *ns);
 bool ve_check_trusted_exec(struct file *file, struct filename *name);
@@ -248,6 +259,16 @@ extern bool is_ve_init_net(const struct net *net);
 #define get_ve(ve)     ((void)(ve), NULL)
 #define put_ve(ve)     do { (void)(ve); } while (0)
 
+static inline struct ve_struct *task_ve(struct task_struct *task)
+{
+       return NULL;
+}
+
+static inline struct ve_struct *get_task_ve(struct task_struct *task)
+{
+       return NULL;
+}
+
 static inline void ve_stop_ns(struct pid_namespace *ns) { }
 static inline void ve_exit_ns(struct pid_namespace *ns) { }
 
_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to