mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Topi Miettinen <toiwoton@gmail.com>
To: nicolas.dichtel@6wind.com, linux-kernel@vger.kernel.org
Cc: Jonathan Corbet <corbet@lwn.net>, Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Balbir Singh <bsingharora@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Markus Elfring <elfring@users.sourceforge.net>,
	Thomas Gleixner <tglx@linutronix.de>,
	Rik van Riel <riel@redhat.com>,
	"open list:DOCUMENTATION" <linux-doc@vger.kernel.org>
Subject: Re: [PATCH 01/14] resource limits: foundation for resource highwater tracking
Date: Fri, 15 Jul 2016 16:27:13 +0000	[thread overview]
Message-ID: <f76487c4-9d60-d402-10b2-2ff7c0525e78@gmail.com> (raw)
In-Reply-To: <5788DBE4.50406@6wind.com>

On 07/15/16 12:49, Nicolas Dichtel wrote:
> Le 15/07/2016 12:35, Topi Miettinen a écrit :
>> There are many basic ways to control processes, including capabilities,
>> cgroups and resource limits. However, there are far fewer ways to find out
>> useful values for the limits, except blind trial and error.
>>
>> Prepare a foundation for resource highwater tracking.
>>
>> The collected highwater marks for the resources can be seen using
>> taskstats netlink interface.
>>
>> This depends on CONFIG_TASK_XACCT.
>>
>> Signed-off-by: Topi Miettinen <toiwoton@gmail.com>
>> ---
> [snip]
>> @@ -63,6 +65,8 @@ int print_task_context_switch_counts;
>>  /* Maximum number of cpus expected to be specified in a cpumask */
>>  #define MAX_CPUS	32
>>  
>> +#define TASKSTATS_VERSION_WITH_RESOURCE	9
>> +
>>  struct msgtemplate {
>>  	struct nlmsghdr n;
>>  	struct genlmsghdr g;
> [snip]
>> @@ -252,6 +276,22 @@ static void print_ioacct(struct taskstats *t)
>>  		(unsigned long long)t->cancelled_write_bytes);
>>  }
>>  
>> +static void print_racct(const struct taskstats *t)
>> +{
>> +	int i;
>> +
>> +	if (t->version < TASKSTATS_VERSION_WITH_RESOURCE) {
>> +		printf("kernel too old (%d < %d)\n", t->version,
>> +		       TASKSTATS_VERSION_WITH_RESOURCE);
>> +		return;
>> +	}
> 
> [snip]
>> diff --git a/include/uapi/linux/taskstats.h b/include/uapi/linux/taskstats.h
>> index 2466e55..8c65194 100644
>> --- a/include/uapi/linux/taskstats.h
>> +++ b/include/uapi/linux/taskstats.h
>> @@ -33,7 +33,7 @@
>>   */
>>  
>>  
>> -#define TASKSTATS_VERSION	8
>> +#define TASKSTATS_VERSION	9
>>  #define TS_COMM_LEN		32	/* should be >= TASK_COMM_LEN
>>  					 * in linux/sched.h */
>>  
>> @@ -163,6 +163,14 @@ struct taskstats {
>>  	/* Delay waiting for memory reclaim */
>>  	__u64	freepages_count;
>>  	__u64	freepages_delay_total;
>> +	/* Per-task storage I/O accounting ends */
>> +
>> +#define TASKSTATS_HAS_LIMIT_ACCOUNTING
>> +	/* Per-task resource accounting starts */
>> +	__u64   resource_hiwater[RLIM_NLIMITS]; /* high-watermark of
>> +						     RLIMIT
>> +						     resources */
>> +	/* Per-task resource accounting ends */
>>  };
> Why playing with version number? It complexifies the (userland) code and
> existing applications break when the kernel is updated.
> Goal of netlink is to be easily extensible. By adding a new attribute, existing
> userspace tools won't break.

I just followed this text in taskstats.h. Does that give wrong advice?

 * The struct is versioned. Newer versions should only add fields to
 * the bottom of the struct to maintain backward compatibility.
 *
 *
 * To add new fields
 *	a) bump up TASKSTATS_VERSION
 *	b) add comment indicating new version number at end of struct
 *	c) add new fields after version comment; maintain 64-bit alignment

-Topi

> 
> 
> Regards,
> Nicolas
> 

  reply	other threads:[~2016-07-15 16:27 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1468578983-28229-1-git-send-email-toiwoton@gmail.com>
2016-07-15 10:35 ` Topi Miettinen
2016-07-15 12:12   ` kbuild test robot
2016-07-15 12:49   ` Nicolas Dichtel
2016-07-15 16:27     ` Topi Miettinen [this message]
2016-07-15 17:57       ` Nicolas Dichtel
2016-07-15 10:35 ` [PATCH 02/14] resource limits: aggregate task highwater marks to cgroup level Topi Miettinen
2016-07-15 12:38   ` kbuild test robot
2016-07-15 14:10   ` Tejun Heo
2016-07-15 17:15     ` Topi Miettinen
2016-07-18 22:52       ` Tejun Heo
2016-07-19 16:57         ` Topi Miettinen
2016-07-19 18:18           ` Tejun Heo
2016-07-15 10:35 ` [PATCH 03/14] resource limits: track highwater mark of file sizes Topi Miettinen
2016-07-15 10:35 ` [PATCH 04/14] resource limits: track highwater mark of VM data segment Topi Miettinen
2016-07-15 10:35 ` [PATCH 05/14] resource limits: track highwater mark of stack size Topi Miettinen
2016-07-15 10:35 ` [PATCH 06/14] resource limits: track highwater mark of cores dumped Topi Miettinen
2016-07-15 10:35 ` [PATCH 07/14] resource limits: track highwater mark of user processes Topi Miettinen
2016-07-15 10:35 ` [PATCH 08/14] resource limits: track highwater mark of number of files Topi Miettinen
2016-07-15 10:35 ` [PATCH 10/14] resource limits: track highwater mark of address space size Topi Miettinen
2016-07-15 10:35 ` [PATCH 11/14] resource limits: track highwater mark of number of pending signals Topi Miettinen
2016-07-15 10:35 ` [PATCH 12/14] resource limits: track highwater mark of size of message queues Topi Miettinen
2016-07-15 10:36 ` [PATCH 13/14] resource limits: track highwater mark of niceness Topi Miettinen
2016-07-15 10:36 ` [PATCH 14/14] resource limits: track highwater mark of RT priority Topi Miettinen
2016-07-15 17:42 ` [PATCH 00/14] Present useful limits to user (v2) Topi Miettinen
     [not found] ` <20160715124330.GR30154@twins.programming.kicks-ass.net>
     [not found]   ` <28b4b919-4f50-d9f6-c5e1-d1e92ea1ba1c@gmail.com>
     [not found]     ` <20160715135956.GA3115@twins.programming.kicks-ass.net>
2016-07-15 20:54       ` H. Peter Anvin
2016-07-18 13:00         ` Austin S. Hemmelgarn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f76487c4-9d60-d402-10b2-2ff7c0525e78@gmail.com \
    --to=toiwoton@gmail.com \
    --cc=bsingharora@gmail.com \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=elfring@users.sourceforge.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=nicolas.dichtel@6wind.com \
    --cc=peterz@infradead.org \
    --cc=riel@redhat.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome