[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230506220435.0d7238c8@rorschach.local.home>
Date: Sat, 6 May 2023 22:04:35 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Li kunyu <kunyu@...china.com>
Cc: mingo@...hat.com, peterz@...radead.org, juri.lelli@...hat.com,
vincent.guittot@...aro.org, dietmar.eggemann@....com,
bsegall@...gle.com, mgorman@...e.de, bristot@...hat.com,
vschneid@...hat.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] sched: core: Simplify init_sched_mm_cid()
On Sun, 7 May 2023 10:33:52 +0800
Li kunyu <kunyu@...china.com> wrote:
> int mm_users variable definition move to variable usage location.
Why?
>
> Signed-off-by: Li kunyu <kunyu@...china.com>
> ---
> kernel/sched/core.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index f341e2100304..a66960da3f5c 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -11910,10 +11910,9 @@ static void task_mm_cid_work(struct callback_head *work)
> void init_sched_mm_cid(struct task_struct *t)
> {
> struct mm_struct *mm = t->mm;
> - int mm_users = 0;
>
> if (mm) {
> - mm_users = atomic_read(&mm->mm_users);
> + int mm_users = atomic_read(&mm->mm_users);
This is not a requirement, and not everyone prefers this method.
If anything, a real cleanup would simply be to remove the "= 0" and
just have it be:
int mm_users;
As there's no reason to initialize it to zero.
-- Steve
> if (mm_users == 1)
> mm->mm_cid_next_scan = jiffies + msecs_to_jiffies(MM_CID_SCAN_DELAY);
> }
Powered by blists - more mailing lists