Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1446676

Re: [PATCH 1/2] cgroup_pids: track highwater mark of pids

From Tejun Heo <tj@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] cgroup_pids: track highwater mark of pids
Date 2016-07-19 21:10 +0200
Message-ID <rWIyZ-7UN-1@gated-at.bofh.it> (permalink)
References <rW0xY-59Z-1@gated-at.bofh.it> <rW0xY-59Z-33@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hello,

On Sun, Jul 17, 2016 at 11:03:38PM +0300, Topi Miettinen wrote:
> +static void pids_update_highwater_mark(struct pids_cgroup *p)
> +{
> +	while (1) {
> +		int64_t old_mark, new_mark, cur_mark;
> +
> +		old_mark = atomic64_read(&p->highwater_mark);
> +		new_mark = atomic64_read(&p->counter);
> +		if (old_mark >= new_mark)
> +			return;
> +		cur_mark = atomic64_cmpxchg(&p->highwater_mark, old_mark,
> +					    new_mark);
> +
> +		/* It's OK if the counter was decreased meanwhile */
> +		if (cur_mark == old_mark &&
> +		    atomic64_read(&p->counter) <= new_mark)
> +			return;
> +	}
> +}

I think it'd be better to make this part of pids_charge() - maybe use
atomic64_add_return() to get the current value and track the maximum?

> @@ -300,6 +341,11 @@ static struct cftype pids_files[] = {
>  		.read_s64 = pids_current_read,
>  		.flags = CFTYPE_NOT_ON_ROOT,
>  	},
> +	{
> +		.name = "highwater_mark",
> +		.read_s64 = pids_highwater_mark_read,
> +		.flags = CFTYPE_NOT_ON_ROOT,
> +	},

This should be an entry in the pids.stats file.  Please also update
the documentation accordingly.

Thanks.

-- 
tejun

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH 0/2] help configure some cgroup limits (v2) Topi Miettinen <toiwoton@gmail.com> - 2016-07-17 22:10 +0200
  [PATCH 2/2] device_cgroup: track and present accessed devices Topi Miettinen <toiwoton@gmail.com> - 2016-07-17 22:10 +0200
  [PATCH 1/2] cgroup_pids: highwater mark of pids Topi Miettinen <toiwoton@gmail.com> - 2016-07-17 22:10 +0200
  [PATCH 1/2] cgroup_pids: track highwater mark of pids Topi Miettinen <toiwoton@gmail.com> - 2016-07-17 22:10 +0200
    Re: [PATCH 1/2] cgroup_pids: track highwater mark of pids Tejun Heo <tj@kernel.org> - 2016-07-19 21:10 +0200

csiph-web