Re: [RFC PATCH v2 11/17] sched: Basic tracking of matching tasks

From: Tim Chen
Date: Tue Apr 23 2019 - 20:17:53 EST



> +
> +void sched_core_enqueue(struct rq *rq, struct task_struct *p)
> +{

...

> +}
> +
> +void sched_core_dequeue(struct rq *rq, struct task_struct *p)
> +{

...

> +}
> +
> +/*
> + * Find left-most (aka, highest priority) task matching @cookie.
> + */
> +struct task_struct *sched_core_find(struct rq *rq, unsigned long cookie)
> +{

...


The sched_core_* functions are used only in the core.c
they are declared in. We can convert them to static functions.

Thanks.

Tim

---
kernel/sched/core.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 14e766d0df99..455e7ecc2f48 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -155,7 +155,7 @@ static inline bool __sched_core_less(struct task_struct *a, struct task_struct *
return false;
}

-void sched_core_enqueue(struct rq *rq, struct task_struct *p)
+static void sched_core_enqueue(struct rq *rq, struct task_struct *p)
{
struct rb_node *parent, **node;
struct task_struct *node_task;
@@ -182,7 +182,7 @@ void sched_core_enqueue(struct rq *rq, struct task_struct *p)
rb_insert_color(&p->core_node, &rq->core_tree);
}

-void sched_core_dequeue(struct rq *rq, struct task_struct *p)
+static void sched_core_dequeue(struct rq *rq, struct task_struct *p)
{
rq->core->core_task_seq++;

@@ -195,7 +195,7 @@ void sched_core_dequeue(struct rq *rq, struct task_struct *p)
/*
* Find left-most (aka, highest priority) task matching @cookie.
*/
-struct task_struct *sched_core_find(struct rq *rq, unsigned long cookie)
+static struct task_struct *sched_core_find(struct rq *rq, unsigned long cookie)
{
struct rb_node *node = rq->core_tree.rb_node;
struct task_struct *node_task, *match;
@@ -221,7 +221,7 @@ struct task_struct *sched_core_find(struct rq *rq, unsigned long cookie)
return match;
}

-struct task_struct *sched_core_next(struct task_struct *p, unsigned long cookie)
+static struct task_struct *sched_core_next(struct task_struct *p, unsigned long cookie)
{
struct rb_node *node = &p->core_node;

@@ -282,7 +282,7 @@ static void __sched_core_disable(void)
printk("core sched disabled\n");
}

-void sched_core_get(void)
+static void sched_core_get(void)
{
mutex_lock(&sched_core_mutex);
if (!sched_core_count++)
@@ -290,7 +290,7 @@ void sched_core_get(void)
mutex_unlock(&sched_core_mutex);
}

-void sched_core_put(void)
+static void sched_core_put(void)
{
mutex_lock(&sched_core_mutex);
if (!--sched_core_count)
--
2.20.1