From patchwork Sat Dec 17 18:55:35 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: 34259 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp1640309wrn; Sat, 17 Dec 2022 11:09:51 -0800 (PST) X-Google-Smtp-Source: AMrXdXuNKfpyVZkidAN+qHOjHfwss/ylpU2L8guQv2JEyoIoYjKEwrp5xiaZenSkuMhd4ry4kqfy X-Received: by 2002:a17:902:f353:b0:189:8583:c39d with SMTP id q19-20020a170902f35300b001898583c39dmr2616151ple.62.1671304190809; Sat, 17 Dec 2022 11:09:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671304190; cv=none; d=google.com; s=arc-20160816; b=xfli2IA6J1EfAaRGSy9JRoUbq1/PFl2SeedlcKIPG6IMb8fwVP2TtaiqAOwpeJGqFD 0myGNPb4WtnN1waEHseHmj6mYQlF2LDFTqjrIKlQzUWZQDxk72urLxrknAoSy+ZU7NZE PPBw9CXnVjgSlMz0hClAWWCYvmS9d0HDxUz8XoYV8AI+BCMbNSMRAIDFeobPks5bZ3IP Gh5/AkqXBDn62dnFanRVGnAwfgB/zC5/q+w9rlMz+buIBAGIUW2qJoRj+QzU1uoqpAaT C+ogmO2+nwoX23SiOwd2WZlJSw2KNqBGFRuCik+Sb+4NbN09Bvgq0pd6DDtm0lecxoon hJpQ== 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=fsb0Jky4Qbbe8cnWUN8Cl6XFdmY6ZEPk8sT8k7OCHro=; b=Bdqd2bnYzaHyIMJ0CRRzcJ2VzR9vuJKWROQOndMQqKQGoi5Tes0cUbNK0/wKpYfdrm dnejDEIhzQNDeK/oc1O554bPLz2F/ojvUT1FaE5e46CH7bmVEU0OqUgLx2DQDsmXwRbf HbHgPQDv2YUf+3y0PsNOLJu39zm+nvGY7XR1ZJkHIaCPNSGPft6yhZzg7mwl+4Rulcpv 8XbanPWe/oUtZ0No6qjLojIn8d+LkD7WSbMcTZzAM0EJ3epZkAmozSOMLbzcFgBj6RnJ kaaTygNz4ljCyJiO8N2sd+BRZUPLtJLClqlmGlngyCrQThYUV5p7sGCb1t79vQwGWGkK m09g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=VN5BLets; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=iyj2VDJO; 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 u32-20020a634720000000b0047867fcf9a7si6164843pga.541.2022.12.17.11.09.37; Sat, 17 Dec 2022 11:09:50 -0800 (PST) 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=VN5BLets; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=iyj2VDJO; 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 S230423AbiLQS6L (ORCPT + 99 others); Sat, 17 Dec 2022 13:58:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230119AbiLQSzt (ORCPT ); Sat, 17 Dec 2022 13:55:49 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 521141122; Sat, 17 Dec 2022 10:55:40 -0800 (PST) Date: Sat, 17 Dec 2022 18:55:35 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1671303335; 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=fsb0Jky4Qbbe8cnWUN8Cl6XFdmY6ZEPk8sT8k7OCHro=; b=VN5BLetsCRuETKO1ufW94UeZ28u1GLfSAxvECKynD1gnBwZHRxarQIKdWyNkgE7ifarx6a fVLKvPG5tQNHC+49YpPVMS+RKD2vuZYRzWY/LnbP7o9eSh1Q8Y7PrfxBkuyp4o7Zau1NEJ tXcT6IRRTSO6dd81046MOaOoKiKYp6ABg70wucApSS6p1sl3/7uMGyP4J0MNmf7naVOn9k 6RV6SFAkoHiKIVPDpCXbBwsRRTDXb5rwamL9EEUZzIKKub/cPynGTlyQEq458G6XHuN0sW Kl8Rv/fdZkcBWZ4SfEKIhIfLZKBddEkXc3bR1GDCuqashhKziQL/61BJSB3zgA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1671303335; 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=fsb0Jky4Qbbe8cnWUN8Cl6XFdmY6ZEPk8sT8k7OCHro=; b=iyj2VDJO8dFPaA5iQY4v0exTbC3QaP7dsbQrr8fkKobX72Pj896WAXuWaK4FWsvQuEG3SS uaiZ7PtK/Gy5kuCA== 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: <167130333552.4906.17400654465838216645.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?1752489462839207799?= The following commit has been merged into the x86/mm branch of tip: Commit-ID: 3f4c8211d982099be693be9aa7d6fc4607dff290 Gitweb: https://git.kernel.org/tip/3f4c8211d982099be693be9aa7d6fc4607dff290 Author: Peter Zijlstra AuthorDate: Tue, 25 Oct 2022 21:38:21 +02:00 Committer: Dave Hansen CommitterDate: Thu, 15 Dec 2022 10:37:26 -08: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.