[PATCH v4 1/6] cgroup/pids: Remove superfluous zeroing

Michal Koutný posted 6 patches 1 year, 9 months ago
There is a newer version of this series
[PATCH v4 1/6] cgroup/pids: Remove superfluous zeroing
Posted by Michal Koutný 1 year, 9 months ago
Atomic counters are in kzalloc'd struct. They are zeroed already and
atomic64_t does not need special initialization
(cf kernel/trace/trace_clock.c:trace_counter).

Signed-off-by: Michal Koutný <mkoutny@suse.com>
---
 kernel/cgroup/pids.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/kernel/cgroup/pids.c b/kernel/cgroup/pids.c
index 7695e60bcb40..0e5ec7d59b4d 100644
--- a/kernel/cgroup/pids.c
+++ b/kernel/cgroup/pids.c
@@ -75,9 +75,7 @@ pids_css_alloc(struct cgroup_subsys_state *parent)
 	if (!pids)
 		return ERR_PTR(-ENOMEM);
 
-	atomic64_set(&pids->counter, 0);
 	atomic64_set(&pids->limit, PIDS_MAX);
-	atomic64_set(&pids->events_limit, 0);
 	return &pids->css;
 }
 
-- 
2.44.0

Re: [PATCH v4 1/6] cgroup/pids: Remove superfluous zeroing
Posted by Tejun Heo 1 year, 9 months ago
On Tue, Apr 16, 2024 at 04:20:09PM +0200, Michal Koutný wrote:
> Atomic counters are in kzalloc'd struct. They are zeroed already and
> atomic64_t does not need special initialization
> (cf kernel/trace/trace_clock.c:trace_counter).
> 
> Signed-off-by: Michal Koutný <mkoutny@suse.com>

Applied to cgroup/for-6.10.

Thanks.

-- 
tejun