Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1444428
| From | Topi Miettinen <toiwoton@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 01/14] resource limits: foundation for resource highwater tracking |
| Date | 2016-07-15 18:30 +0200 |
| Message-ID | <rVe9X-GD-19@gated-at.bofh.it> (permalink) |
| References | <rV8Hf-5Li-5@gated-at.bofh.it> <rV8Hf-5Li-3@gated-at.bofh.it> <rVaJ3-6Xs-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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
>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 01/14] resource limits: foundation for resource highwater tracking Topi Miettinen <toiwoton@gmail.com> - 2016-07-15 12:40 +0200
Re: [PATCH 01/14] resource limits: foundation for resource highwater tracking kbuild test robot <lkp@intel.com> - 2016-07-15 14:20 +0200
Re: [PATCH 01/14] resource limits: foundation for resource highwater tracking Nicolas Dichtel <nicolas.dichtel@6wind.com> - 2016-07-15 14:50 +0200
Re: [PATCH 01/14] resource limits: foundation for resource highwater tracking Topi Miettinen <toiwoton@gmail.com> - 2016-07-15 18:30 +0200
Re: [PATCH 01/14] resource limits: foundation for resource highwater tracking Nicolas Dichtel <nicolas.dichtel@6wind.com> - 2016-07-15 20:00 +0200
csiph-web