From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755984AbZLDKlc (ORCPT ); Fri, 4 Dec 2009 05:41:32 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755852AbZLDKla (ORCPT ); Fri, 4 Dec 2009 05:41:30 -0500 Received: from casper.infradead.org ([85.118.1.10]:38900 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754301AbZLDKl3 (ORCPT ); Fri, 4 Dec 2009 05:41:29 -0500 Subject: Re: [PATCH 4/7] sched: implement force_cpus_allowed() From: Peter Zijlstra To: Tejun Heo Cc: tglx@linutronix.de, mingo@elte.hu, avi@redhat.com, efault@gmx.de, rusty@rustcorp.com.au, linux-kernel@vger.kernel.org In-Reply-To: <1259726212-30259-5-git-send-email-tj@kernel.org> References: <1259726212-30259-1-git-send-email-tj@kernel.org> <1259726212-30259-5-git-send-email-tj@kernel.org> Content-Type: text/plain; charset="UTF-8" Date: Fri, 04 Dec 2009 11:40:59 +0100 Message-ID: <1259923259.3977.1928.camel@laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.28.1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2009-12-02 at 12:56 +0900, Tejun Heo wrote: > set_cpus_allowed_ptr() modifies the allowed cpu mask of a task. The > function performs the following checks before applying new mask. > > * Check whether PF_THREAD_BOUND is set. This is set for bound > kthreads so that they can't be moved around. > > * Check whether the target cpu is still marked active - cpu_active(). > Active state is cleared early while downing a cpu. > > This patch adds force_cpus_allowed() which bypasses the above two > checks. The caller is responsible for guaranteeing that the > destination cpu doesn't go down until force_cpus_allowed() finishes. > > The first check is bypassed by factoring out actual migration part > into __set_cpus_allowed() from set_cpus_allowed_ptr() and calling the > inner function from force_cpus_allowed(). > > The second check is buried deep down in __migrate_task() which is > executed by migration threads. @force parameter is added to > __migrate_task(). As the only way to pass parameters from > __set_cpus_allowed() is through migration_req, migration_req->force is > added and the @force parameter is passed down to __migrate_task(). > > Please note the naming discrepancy between set_cpus_allowed_ptr() and > the new functions. The _ptr suffix is from the days when cpumask api > wasn't mature and future changes should drop it from > set_cpus_allowed_ptr() too. > > force_cpus_allowed() will be used for concurrency-managed workqueue. Would still like to know why all this is needed.