lkml.org 
[lkml]   [2015]   [May]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v10 3/4] cgroups: allow a cgroup subsystem to reject a fork
From
Hi Tejun,

>> +/* Ditto for the can_fork/cancel_fork/reapply_fork callbacks. */
>> +static int need_canfork_callback __read_mostly;
>> +static int need_cancelfork_callback __read_mostly;
>
> And given that the reason we have these masks is avoiding iteration in
> relatively hot paths. Does cancelfork mask make sense?

Do you still want me to remove it? I only added it because it made the
callback code more consistent for cancel_fork and can_fork.

>> +void cgroup_cancel_fork(struct task_struct *child,
>> + void *ss_state[CGROUP_PREFORK_COUNT])
>> +{
>> + struct cgroup_subsys *ss;
>> + int i;
>> +
>> + for_each_subsys_which(need_cancelfork_callback, ss, i) {
>> + void *state = NULL;
>> +
>> + if (CGROUP_PREFORK_START <= i && i < CGROUP_PREFORK_END)
>> + state = ss_state[i - CGROUP_PREFORK_START];
>
> Maybe we want a helper callback which does
>
> if (CGROUP_PREFORK_START <= ssid && ssid < CGROUP_PREFORK_END)
> return &ss_state[ssid - CGROUP_PREFORK_START];
> return NULL;

What would be a nice name for it? I can't think of anything better
than __get_ss_private() and __get_ss_privatep().

--
Aleksa Sarai (cyphar)
www.cyphar.com


\
 
 \ /
  Last update: 2015-05-14 13:21    [W:0.071 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site