From patchwork Fri Feb 8 20:10:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Fields X-Patchwork-Id: 10803719 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 68EBD13B5 for ; Fri, 8 Feb 2019 20:10:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 591E42EA09 for ; Fri, 8 Feb 2019 20:10:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D3122EA20; Fri, 8 Feb 2019 20:10:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF1782EA09 for ; Fri, 8 Feb 2019 20:10:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727609AbfBHUKu (ORCPT ); Fri, 8 Feb 2019 15:10:50 -0500 Received: from fieldses.org ([173.255.197.46]:57040 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727247AbfBHUKt (ORCPT ); Fri, 8 Feb 2019 15:10:49 -0500 Received: by fieldses.org (Postfix, from userid 2815) id CDFB23F4; Fri, 8 Feb 2019 15:10:48 -0500 (EST) From: "J. Bruce Fields" To: linux-nfs@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Trond Myklebust , Jeff Layton , David Howells , Tejun Heo , Peter Zijlstra , Shaohua Li , Oleg Nesterov , "J. Bruce Fields" Subject: [PATCH 2/7] kthreads: Simplify tsk_fork_get_node Date: Fri, 8 Feb 2019 15:10:42 -0500 Message-Id: <1549656647-25115-3-git-send-email-bfields@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1549656647-25115-1-git-send-email-bfields@redhat.com> References: <1549656647-25115-1-git-send-email-bfields@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "J. Bruce Fields" This will also simplify a following patch that allows multiple kthreadd's. Signed-off-by: J. Bruce Fields --- init/init_task.c | 3 +++ kernel/fork.c | 4 ++++ kernel/kthread.c | 3 +-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/init/init_task.c b/init/init_task.c index 5aebe3be4d7c..47e4829ec53f 100644 --- a/init/init_task.c +++ b/init/init_task.c @@ -153,6 +153,9 @@ struct task_struct init_task .vtime.starttime = 0, .vtime.state = VTIME_SYS, #endif +#ifdef CONFIG_NUMA + .pref_node_fork = NUMA_NO_NODE, +#endif #ifdef CONFIG_NUMA_BALANCING .numa_preferred_nid = -1, .numa_group = NULL, diff --git a/kernel/fork.c b/kernel/fork.c index b69248e6f0e0..c5b5629de2a9 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -912,6 +912,10 @@ static struct task_struct *dup_task_struct(struct task_struct *orig, int node) tsk->fail_nth = 0; #endif +#ifdef CONFIG_NUMA + tsk->pref_node_fork = NUMA_NO_NODE; +#endif + #ifdef CONFIG_BLK_CGROUP tsk->throttle_queue = NULL; tsk->use_memdelay = 0; diff --git a/kernel/kthread.c b/kernel/kthread.c index 672f0bbf4d89..4428fd586cd8 100644 --- a/kernel/kthread.c +++ b/kernel/kthread.c @@ -252,8 +252,7 @@ static int kthread(void *_create) int tsk_fork_get_node(struct task_struct *tsk) { #ifdef CONFIG_NUMA - if (tsk == kthreadd_task) - return tsk->pref_node_fork; + return tsk->pref_node_fork; #endif return NUMA_NO_NODE; }