Skip to contentSkip to conversation

sched: Use kmem_cache_zalloc() instead of kmem_cache_alloc() with flag GFP_ZERO.

PATCH In review Yi Wang 2 participants 2 messages Feb 12, 2020 Scheduler

lore
Share & tools
lore

Yi Wang

author
#0 lore raw

PATCH 1/1 sched: Use kmem_cache_zalloc() instead of kmem_cache_alloc() with flag GFP_ZERO.

From: Huang Zijiang <[email protected]>

Use kmem_cache_zalloc instead of manually setting kmem_cache_alloc with flag GFP_ZERO since kzalloc sets allocated memory to zero.

Change in v2:
add indation

---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
index 90e4b00..20ea28f 100644
@@ -6949,7 +6949,7 @@ struct task_group *sched_create_group(struct task_group *parent)
 {
 	struct task_group *tg;
 
-	tg = kmem_cache_alloc(task_group_cache, GFP_KERNEL | __GFP_ZERO);
+	tg = kmem_cache_zalloc(task_group_cache, GFP_KERNEL);
 	if (!tg)
 		return ERR_PTR(-ENOMEM);
 
Signature · 1 line
1.9.1
maintainer
#1 lore raw
Quoted 8 lines · Yi Wang

From: Huang Zijiang <[email protected]>

Use kmem_cache_zalloc instead of manually setting kmem_cache_alloc with flag GFP_ZERO since kzalloc sets allocated memory to zero.

Change in v2:
add indation

Why? Isn't this more or less a whitespace change?