From patchwork Wed Nov 2 09:12:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 14142 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3508248wru; Wed, 2 Nov 2022 02:24:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM75sA9+HUDYh5Mpvn6VkWXNX+COlLGiDjuCTpK3hOCklFynY6G99t4Skgm89YroG3ie52i3 X-Received: by 2002:a17:906:1c0e:b0:7ad:c648:a4af with SMTP id k14-20020a1709061c0e00b007adc648a4afmr17495864ejg.277.1667381064692; Wed, 02 Nov 2022 02:24:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667381064; cv=none; d=google.com; s=arc-20160816; b=gr+70tlLkB3v8Soa40mYuu6At9KXf8pzQ3iOKYtv679bTfkF9rmTAEY7V3Poz8NOD6 biFZOmlu0oeJeWK+TWz2VTEBxvw5fkpvJJ3ygW5336ecjgn7Ihg7ye5nqk29ma40EBfm 4JJCn/EDOrlRy/faUMnus8FYnqA4sIn8wZ+BoD+Kab/K99oBbZS3jBjEfnT7U8ikZVhw TVfQvFLCHKxXqbO47FwgVYi6EP9sVGjauysbD9pHR3PZiBhv1cxoBf6w3g4ps1VFjHuz 4kh2pEEjy0ud/U4v6BSTYIVkjoIFsJVLRI/B81X6M0Ku9CT3AYbc1+/dImVQQNpgrt+4 caCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=QBGb15kTgZTC7LVKUgw7F/Ft/+M/1NqTiaauPnWiM6A=; b=UNlHUNhfRwUOAQjGtQrfTk2LZ4RRsqFMuUUTcj3T6E9pwrqNVSO+y9Zqf8Oss0vAHu He8gqwhhLb1nPlHSTLbXQTYEuk3AzzHu1Yze8vdlya7N9Dv3lXy92oGY2PmGQwhiIHbU mt5kebLmbRlIC1ConOCLmiGcTfYnVpC6M7EPrhCfo+KN83wtXbnpanrk84rVlGLxLd1k g5rFMi7syIVhxcvsorxE6yFyqEmKQQRviE7HAvBq3sOxRhJySQ0w8u2sBE7vaE0tLkA5 lOjzNWbKoTgBxhbhEjd+ba62d8WqRYS2xJ6VNovu/h3nuhBv0480SIFwaPAQcAuP8HRT 6MJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=n4SrdBuI; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g16-20020a1709065d1000b007add0c2ee2csi9259844ejt.924.2022.11.02.02.24.00; Wed, 02 Nov 2022 02:24:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=n4SrdBuI; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231576AbiKBJOz (ORCPT + 99 others); Wed, 2 Nov 2022 05:14:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231464AbiKBJNj (ORCPT ); Wed, 2 Nov 2022 05:13:39 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F10F2935B; Wed, 2 Nov 2022 02:12:55 -0700 (PDT) Date: Wed, 02 Nov 2022 09:12:52 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1667380374; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QBGb15kTgZTC7LVKUgw7F/Ft/+M/1NqTiaauPnWiM6A=; b=n4SrdBuILriDh71DF6zX5KTeg1RrX6uOwHjQJEqXSJlcDmR/vDqtBU6aRCvygAeE6P9ngA 3loIOS4KAPxPt2jNZmz3/v0V3Bcmx+U8G1HJsFJkteAIjAymUepcT7UfDei1M/TVhQ1f1L tqv78Hoa7M30ASJo6Hh8yd5CeJbtBHyPs7IoRB7F7lvA70E/ylGkLPNiqjyorp0xyik6xj XfKoxoIaBZuhdjDh27pSDLFhwhZ6XyqMHKzAuRD4wAzfzLrsk2VyHJYCULSwNxkjLJ3nTs nxlovx1QHVzvL2T+41c04R9invFV5qixfHrCHyED+xmXWryhUKeaMDJgUMIg1g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1667380374; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QBGb15kTgZTC7LVKUgw7F/Ft/+M/1NqTiaauPnWiM6A=; b=VzzbJVcGoVnWOG+f3D4AbeYFwn1tqq70rL+JUGpF2e4GE1jMX62aCxsVsG9RyHvO5s9vCV qAJJCn5lUB4GqCCw== From: "tip-bot2 for Peter Zijlstra" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/mm] x86/mm: Use mm_alloc() in poking_init() Cc: "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20221025201057.816175235@infradead.org> References: <20221025201057.816175235@infradead.org> MIME-Version: 1.0 Message-ID: <166738037248.7716.549727763487721317.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747691929011045474?= X-GMAIL-MSGID: =?utf-8?q?1748375767031399789?= The following commit has been merged into the x86/mm branch of tip: Commit-ID: 107b6828a7cde2de0bb293588a59892831cef78b Gitweb: https://git.kernel.org/tip/107b6828a7cde2de0bb293588a59892831cef78b Author: Peter Zijlstra AuthorDate: Tue, 25 Oct 2022 21:38:21 +02:00 Committer: Peter Zijlstra CommitterDate: Tue, 01 Nov 2022 13:43:57 +01:00 x86/mm: Use mm_alloc() in poking_init() Instead of duplicating init_mm, allocate a fresh mm. The advantage is that mm_alloc() has much simpler dependencies. Additionally it makes more conceptual sense, init_mm has no (and must not have) user state to duplicate. Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20221025201057.816175235@infradead.org --- arch/x86/mm/init.c | 2 +- include/linux/sched/task.h | 1 - kernel/fork.c | 5 ----- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index 9121bc1..d398735 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c @@ -801,7 +801,7 @@ void __init poking_init(void) spinlock_t *ptl; pte_t *ptep; - poking_mm = copy_init_mm(); + poking_mm = mm_alloc(); BUG_ON(!poking_mm); /* diff --git a/include/linux/sched/task.h b/include/linux/sched/task.h index 8431558..357e006 100644 --- a/include/linux/sched/task.h +++ b/include/linux/sched/task.h @@ -91,7 +91,6 @@ extern void exit_itimers(struct task_struct *); extern pid_t kernel_clone(struct kernel_clone_args *kargs); struct task_struct *create_io_thread(int (*fn)(void *), void *arg, int node); struct task_struct *fork_idle(int); -struct mm_struct *copy_init_mm(void); extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); extern pid_t user_mode_thread(int (*fn)(void *), void *arg, unsigned long flags); extern long kernel_wait4(pid_t, int __user *, int, struct rusage *); diff --git a/kernel/fork.c b/kernel/fork.c index 451ce80..6142c58 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -2592,11 +2592,6 @@ struct task_struct * __init fork_idle(int cpu) return task; } -struct mm_struct *copy_init_mm(void) -{ - return dup_mm(NULL, &init_mm); -} - /* * This is like kernel_clone(), but shaved down and tailored to just * creating io_uring workers. It returns a created task, or an error pointer.