linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] delayacct: optimize delayacct init
@ 2021-09-11  7:41 cgel.zte
  2021-09-15  3:41 ` kernel test robot
  0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2021-09-11  7:41 UTC (permalink / raw)
  To: bsingharora, peterz; +Cc: linux-kernel, Yang Yang

From: Yang Yang <yang.yang29@zte.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@zte.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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-15  3:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-11  7:41 [PATCH] delayacct: optimize delayacct init cgel.zte
2021-09-15  3:41 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).