Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932091AbbENK5w (ORCPT ); Thu, 14 May 2015 06:57:52 -0400 Received: from mail-ie0-f175.google.com ([209.85.223.175]:35874 "EHLO mail-ie0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753399AbbENK5t (ORCPT ); Thu, 14 May 2015 06:57:49 -0400 MIME-Version: 1.0 X-Originating-IP: [122.106.150.15] In-Reply-To: <20150422155445.GD10738@htj.duckdns.org> References: <1429446154-10660-1-git-send-email-cyphar@cyphar.com> <1429446154-10660-4-git-send-email-cyphar@cyphar.com> <20150422155445.GD10738@htj.duckdns.org> Date: Thu, 14 May 2015 20:57:49 +1000 Message-ID: Subject: Re: [PATCH v10 3/4] cgroups: allow a cgroup subsystem to reject a fork From: Aleksa Sarai To: Tejun Heo Cc: lizefan@huawei.com, mingo@redhat.com, Peter Zijlstra , richard@nod.at, =?UTF-8?B?RnLDqWTDqXJpYyBXZWlzYmVja2Vy?= , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1497 Lines: 41 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/