lkml.org 
[lkml]   [2009]   [Jul]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH] taskstats: Fix CGROUPSTATS_TYPE_CGROUP_STATS having same value as TASKSTATS_TYPE_PID
* Nikanth Karthikesan <knikanth@suse.de> [2009-07-13 18:31:12]:

> Hi
>
> Currently we never get message from kernel to userspace of type
> TASKSTATS_TYPE_PID. Otherwise this could have been spotted earlier.
>
> I was trying to add a new taskstat command that would return response of type
> TASKSTATS_TYPE_PID.
>
> Having the same values would restrict one not to use the same netlink socket
> for a command that would return response of type TASKSTATS_TYPE_PID and the
> CGROUPSTATS_CMD_GET command.
>
> Should we fix it by using values after __TASKSTATS_TYPE_MAX.
>
> Changing this now might break pre-built binaries. Or is this intended, and the
> application is not supposed to use CGROUPSTATS and TASKSTATS on the same
> socket?
>

Ideally they are supposed to be on different sockets, but nothing
really is hard and fast in terms of rules.

> Thanks
> Nikanth
>
> Currently we never get message from kernel to userspace of type
> TASKSTATS_TYPE_PID. Otherwise this could have been spotted earlier. Having the
> values in the same range would restrict one not to use the same netlink socket
> for a command that would return response of type TASKSTATS_TYPE_PID and the
> CGROUPSTATS_CMD_GET command. Fix it by using values after
> __TASKSTATS_TYPE_MAX.
>
> Signed-off-by: Nikanth Karthikesan <knikanth@suse.de>
>
> ---
>
>
> diff --git a/include/linux/cgroupstats.h b/include/linux/cgroupstats.h
> index 3753c33..87b31f0 100644
> --- a/include/linux/cgroupstats.h
> +++ b/include/linux/cgroupstats.h
> @@ -53,7 +53,7 @@ enum {
> #define CGROUPSTATS_CMD_MAX (__CGROUPSTATS_CMD_MAX - 1)
>
> enum {
> - CGROUPSTATS_TYPE_UNSPEC = 0, /* Reserved */
> + CGROUPSTATS_TYPE_UNSPEC = __TASKSTATS_TYPE_MAX, /* Reserved */
> CGROUPSTATS_TYPE_CGROUP_STATS, /* contains name + stats */
> __CGROUPSTATS_TYPE_MAX,
> };
>

This seems like the correct fix

Reviewed-by: Balbir Singh <balbir@linux.vnet.ibm.com>



--
Balbir


\
 
 \ /
  Last update: 2009-07-13 15:45    [W:3.275 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site