Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753672AbbBSXMO (ORCPT ); Thu, 19 Feb 2015 18:12:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36169 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752427AbbBSXMM (ORCPT ); Thu, 19 Feb 2015 18:12:12 -0500 Date: Thu, 19 Feb 2015 17:11:41 -0600 From: Josh Poimboeuf To: Jiri Kosina Cc: Vojtech Pavlik , Peter Zijlstra , Andrew Morton , Ingo Molnar , Seth Jennings , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] sched: add sched_task_call() Message-ID: <20150219231141.GE15980@treble.redhat.com> References: <20150218171256.GA28553@treble.hsd1.ky.comcast.net> <20150219002058.GD5029@twins.programming.kicks-ass.net> <20150219041753.GA13423@treble.redhat.com> <20150219101607.GG5029@twins.programming.kicks-ass.net> <20150219162429.GA15980@treble.redhat.com> <20150219163359.GA25438@suse.cz> <20150219170353.GB15980@treble.redhat.com> <20150219171929.GA13178@suse.cz> <20150219173255.GC15980@treble.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1200 Lines: 33 On Thu, Feb 19, 2015 at 10:26:09PM +0100, Jiri Kosina wrote: > On Thu, 19 Feb 2015, Josh Poimboeuf wrote: > > > How about with a TIF_IN_USERSPACE thread flag? It could be cleared/set > > right at the border. Then for running tasks it's as simple as: > > > > if (test_tsk_thread_flag(task, TIF_IN_USERSPACE)) > > klp_switch_task_universe(task); > > That's in principle what CONTEXT_TRACKING is doing, i.e. the condition > we'd be interested in would be > > __this_cpu_read(context_tracking.state) == IN_USER > > But it has overhead. Yeah, that does seem to pretty much do what we want. Unfortunately it has a much higher overhead than just setting a thread flag. And from the Kconfig description for CONTEXT_TRACKING_FORCE, which would enable it on all CPUs during boot, "this option brings an overhead that you don't want in production." Maybe that code needs a rewrite to rely on a thread flag instead. Then we could use it too. -- Josh -- 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/