Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752887Ab0KOI5P (ORCPT ); Mon, 15 Nov 2010 03:57:15 -0500 Received: from casper.infradead.org ([85.118.1.10]:53429 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751851Ab0KOI5O convert rfc822-to-8bit (ORCPT ); Mon, 15 Nov 2010 03:57:14 -0500 Subject: Re: [RFC/RFT PATCH v3] sched: automated per tty task groups From: Peter Zijlstra To: Mike Galbraith Cc: Linus Torvalds , Markus Trippelsdorf , Oleg Nesterov , Mathieu Desnoyers , Ingo Molnar , LKML In-Reply-To: <1289783580.495.58.camel@maggy.simson.net> References: <1289489200.11397.21.camel@maggy.simson.net> <20101111202703.GA16282@redhat.com> <1289514000.21413.204.camel@maggy.simson.net> <20101112181240.GB8659@redhat.com> <1289648524.22764.149.camel@maggy.simson.net> <1289755150.3228.44.camel@maggy.simson.net> <20101114174921.GA1569@arch.trippelsdorf.de> <1289758238.17491.12.camel@maggy.simson.net> <20101114202734.GA1627@arch.trippelsdorf.de> <1289778189.5154.10.camel@maggy.simson.net> <1289783580.495.58.camel@maggy.simson.net> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Date: Mon, 15 Nov 2010 09:57:18 +0100 Message-ID: <1289811438.2109.474.camel@laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1366 Lines: 52 On Sun, 2010-11-14 at 18:13 -0700, Mike Galbraith wrote: > +static inline struct task_group * > +autogroup_task_group(struct task_struct *p, struct task_group *tg) > +{ > + int enabled = ACCESS_ONCE(sysctl_sched_autogroup_enabled); > + > + enabled &= (tg == &root_task_group); > + enabled &= (p->sched_class == &fair_sched_class); > + enabled &= (!(p->flags & PF_EXITING)); > + > + if (enabled) > + return p->signal->autogroup->tg; > + > + return tg; > +} That made me go wtf.. curious way of writing things. I guess the usual way of writing that (which is admittedly a little more verbose) would be something like: static bool task_wants_autogroup(struct task_struct *tsk, struct task_group *tg) { if (tg != &root_task_group) return false; if (tsk->sched_class != &fair_sched_class) return false; if (tsk->flags & PF_EXITING) return false; return true; } static inline struct task_group * autogroup_task_group(struct task_struct *tsk, struct task_group *tg) { if (task_wants_autogroup(tsk, tg)) return tsk->signal->autogroup->tg; return tg; } -- 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/