[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210911074120.51914-1-yang.yang29@zte.com.cn>
Date: Sat, 11 Sep 2021 07:41:21 +0000
From: cgel.zte@...il.com
To: bsingharora@...il.com, peterz@...radead.org
Cc: linux-kernel@...r.kernel.org, Yang Yang <yang.yang29@....com.cn>
Subject: [PATCH] delayacct: optimize delayacct init
From: Yang Yang <yang.yang29@....com.cn>
In delayacct_init(), first there is no need to assign delayacct_on to
delayacct_on in set_delayacct(). Second if delayacct_on is 0, there
is no need call delayacct_tsk_init().
Signed-off-by: Yang Yang <yang.yang29@....com.cn>
---
kernel/delayacct.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/kernel/delayacct.c b/kernel/delayacct.c
index 51530d5b15a8..cbf80273be6d 100644
--- a/kernel/delayacct.c
+++ b/kernel/delayacct.c
@@ -39,8 +39,13 @@ __setup("delayacct", delayacct_setup_enable);
void delayacct_init(void)
{
delayacct_cache = KMEM_CACHE(task_delay_info, SLAB_PANIC|SLAB_ACCOUNT);
+
+ if (delayacct_on)
+ static_branch_enable(&delayacct_key);
+ else
+ return;
+
delayacct_tsk_init(&init_task);
- set_delayacct(delayacct_on);
}
#ifdef CONFIG_PROC_SYSCTL
--
2.25.1
Powered by blists - more mailing lists