Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751355AbbBPUon (ORCPT ); Mon, 16 Feb 2015 15:44:43 -0500 Received: from casper.infradead.org ([85.118.1.10]:57314 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750710AbbBPUom (ORCPT ); Mon, 16 Feb 2015 15:44:42 -0500 Date: Mon, 16 Feb 2015 21:44:36 +0100 From: Peter Zijlstra To: Josh Poimboeuf Cc: Andrew Morton , Ingo Molnar , Jiri Kosina , Seth Jennings , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] sched: add sched_task_call() Message-ID: <20150216204436.GH5029@twins.programming.kicks-ass.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 999 Lines: 31 On Mon, Feb 16, 2015 at 12:52:34PM -0600, Josh Poimboeuf wrote: > +++ b/kernel/sched/core.c > @@ -1338,6 +1338,23 @@ void kick_process(struct task_struct *p) > EXPORT_SYMBOL_GPL(kick_process); > #endif /* CONFIG_SMP */ > > +/*** > + * sched_task_call - call a function with a task's state locked > + * > + * The task is guaranteed to remain either active or inactive during the > + * function call. > + */ > +void sched_task_call(sched_task_call_func_t func, struct task_struct *p, > + void *data) > +{ > + unsigned long flags; > + struct rq *rq; > + > + rq = task_rq_lock(p, &flags); > + func(p, data); > + task_rq_unlock(rq, p, &flags); > +} Yeah, I think not. We're so not going to allow running random code under rq->lock and p->pi_lock. -- 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/