]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
sched: add per-task BLOG context slots
authorAlex Markuze <amarkuze@redhat.com>
Thu, 18 Sep 2025 08:42:27 +0000 (08:42 +0000)
committerAlex Markuze <amarkuze@redhat.com>
Thu, 18 Sep 2025 08:42:27 +0000 (08:42 +0000)
include/linux/sched.h
kernel/fork.c

index f96ac198289349199b9c671240a20fc7826228ad..533835ca81d6188ef8690f7d932106f47b908626 100644 (file)
@@ -1274,6 +1274,14 @@ struct task_struct {
        /* Journalling filesystem info: */
        void                            *journal_info;
 
+/* BLOG support - max modules defined here for use by other headers */
+#define BLOG_MAX_MODULES 8
+
+#if defined(CONFIG_BLOG) || defined(CONFIG_BLOG_MODULE)
+       struct blog_tls_ctx             *blog_contexts[BLOG_MAX_MODULES];
+       u8                              blog_ctx_bitmap;
+#endif
+
        /* Stacked block device info: */
        struct bio_list                 *bio_list;
 
index 168681fc4b25a9fddcb90ce155c027551455f4ee..d1c6cc74515dcdb0e449068721a21b42a6091bee 100644 (file)
@@ -24,6 +24,9 @@
 #include <linux/sched/cputime.h>
 #include <linux/sched/ext.h>
 #include <linux/seq_file.h>
+#if defined(CONFIG_BLOG) || defined(CONFIG_BLOG_MODULE)
+#include <linux/blog/blog.h>
+#endif
 #include <linux/rtmutex.h>
 #include <linux/init.h>
 #include <linux/unistd.h>
@@ -180,8 +183,34 @@ static inline struct task_struct *alloc_task_struct_node(int node)
        return kmem_cache_alloc_node(task_struct_cachep, GFP_KERNEL, node);
 }
 
+struct tls_storage {
+       void (*release)(void *state);
+};
+
 static inline void free_task_struct(struct task_struct *tsk)
 {
+/*
+       if (tsk->tls.release) {
+               tsk->tls.release(tsk->tls.state);
+               tsk->tls.state = NULL;
+               tsk->tls.release = NULL;
+       }
+*/
+#if defined(CONFIG_BLOG) || defined(CONFIG_BLOG_MODULE)
+       /* Clean up any BLOG contexts */
+       {
+               int i;
+               for (i = 0; i < BLOG_MAX_MODULES; i++) {
+                       if (tsk->blog_contexts[i]) {
+                               struct blog_tls_ctx *ctx = tsk->blog_contexts[i];
+                               if (ctx->release)
+                                       ctx->release(ctx);
+                               tsk->blog_contexts[i] = NULL;
+                       }
+               }
+               tsk->blog_ctx_bitmap = 0;
+       }
+#endif
        kmem_cache_free(task_struct_cachep, tsk);
 }
 
@@ -2260,6 +2289,17 @@ __latent_entropy struct task_struct *copy_process(
        p = dup_task_struct(current, node);
        if (!p)
                goto fork_out;
+
+#if defined(CONFIG_BLOG) || defined(CONFIG_BLOG_MODULE)
+       /* Initialize BLOG contexts */
+       {
+               int i;
+               for (i = 0; i < BLOG_MAX_MODULES; i++)
+                       p->blog_contexts[i] = NULL;
+               p->blog_ctx_bitmap = 0;
+       }
+#endif
+
        p->flags &= ~PF_KTHREAD;
        if (args->kthread)
                p->flags |= PF_KTHREAD;