Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753515AbaLHE2g (ORCPT ); Sun, 7 Dec 2014 23:28:36 -0500 Received: from mail-qg0-f45.google.com ([209.85.192.45]:47134 "EHLO mail-qg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751072AbaLHE2f (ORCPT ); Sun, 7 Dec 2014 23:28:35 -0500 MIME-Version: 1.0 In-Reply-To: <1418009221-12719-1-git-send-email-anton@samba.org> References: <1418009221-12719-1-git-send-email-anton@samba.org> Date: Sun, 7 Dec 2014 20:28:34 -0800 X-Google-Sender-Auth: 9h0-JSSSkT9DodUDzPTnc78mMuM Message-ID: Subject: Re: [PATCH] kthread: kthread_bind fails to enforce CPU affinity (fixes kernel BUG at kernel/smpboot.c:134!) From: Linus Torvalds To: Anton Blanchard Cc: Andrew Morton , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Steven Rostedt , Tejun Heo , Wu Fengguang , "Rafael J. Wysocki" , yuyang.du@intel.com, lkp@01.org, Yuanhan Liu , Paul Turner , Benjamin Segall , Daniel J Blueman , subbaram@codeaurora.org, Brian Norris , sp@datera.io, Linux Kernel Mailing List , ppc-dev Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Dec 7, 2014 at 7:27 PM, Anton Blanchard wrote: > > Since we cannot call set_task_cpu (the task is in a sleeping state), > just do an explicit set of task_thread_info(p)->cpu. Scheduler people: is this sufficient and ok? The __set_task_cpu() function does various other things too: set_task_rq(p, cpu); #ifdef CONFIG_SMP /* * After ->cpu is set up to a new value, task_rq_lock(p, ...) can be * successfuly executed on another CPU. We must ensure that updates of * per-task data have been completed by this moment. */ smp_wmb(); task_thread_info(p)->cpu = cpu; p->wake_cpu = cpu; #endif which makes me worry about just setting the thread_info->cpu value. That set_task_rq() initializes various group scheduling things, an dthat whole "wake_cpu" thing seems relevant too. I'm not saying the patch is wrong, I just want confirmation/ack for it. Although to be honest, I'd rather see this come in through the scheduler tree anyway. Hmm? This seems to go back to 2.6.33 if that "Fixes" line is accurate, so it's been around forever (almost exactly five years). Comments? Linus -- 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/