Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp815991rdb; Sun, 18 Feb 2024 13:22:03 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVs3TLQo2BQw2yoh5dvya/dA9jVJrwl+7xf61zkV67zS4rbX0fJXDLRLlJK3+zVYE+l2GRgf9+abt7Jl0U1M1+QyoxBPw0ERLDMFy4bjQ== X-Google-Smtp-Source: AGHT+IGmRIGLj25vsd7VT8sj6BAxVoFNre7+FV2gGgvSW0lvS0+K92fN4Mhg+FaxTAhrlhmdudV3 X-Received: by 2002:a05:6214:224c:b0:68c:9ed6:5b87 with SMTP id c12-20020a056214224c00b0068c9ed65b87mr15886408qvc.12.1708291323688; Sun, 18 Feb 2024 13:22:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708291323; cv=pass; d=google.com; s=arc-20160816; b=riWhy04ZhMQyuOrpFCmTqsd5ANC32A0PQ2iSmSIcZr2YglWML5AC2gvQYHiLsFxskT CInCuUokrVVtC2C71R93vqQkH5jDNq1B3L2myNnzMDwzbwMwXlWGmPYk9391dNiBAydO dlUus3uHwXVwDQlsPGlHMY8MhaiKTpRpPTVOOTuK705mA/L1pbtfAO0L7zT9HzX0MnEn q99Qs0D2rS1j2fv6tYQHaCOeSFbMCnTHdjQL8nzaZ4Pq0kzz7iZEK61ldeflyaXvsIOQ nwpNgB3y7lEnn6pJmTDR8hsRaf162psXYLN5UoEsxlPWBWlXCLBR+4vlj6y+TjZlN2Mx QbgQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=mkbGAqFRGBmeftCeVfapk+m/9L7u5bfm7K0eyKSsrkU=; fh=5cEP772/AARsGCv+Qfu6ok15cVq+DeyDHFdJ3SfT/BQ=; b=AR8an1wAw6w666yh4cxsdlaYQfFbLIYg2VLr4mfnvhRkQ4cQsfGeNsjFRK0asRrzbT WT+yfTqmAyiTUy3A1YqdHwQ7vOtdZNM10h2CoT9aw39onWj+PzLr/uw+Skm5PSVn7NaT 9Z69pmKVHPS90sx2UFEZj2RxEBS9svJhgkI8lA4NSi7hHHuUc2HOqTNPuuiJOyMIbijc XwBrt3G153DNk/Ax+p9fKKonsqDEDt1pL7n/eUBy1sIWY89CIJHAt8/scAle3ScLDM9p YAbfDIAWRYVjC/dsv0NAeAWGsgUL24ntO3aL66EEs2hYranEiBUwsrEbvpKU2LvN49Gu 83vg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=gh+L60t0; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-70589-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70589-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 7-20020a0562140d0700b0068f3fccc51csi4707684qvh.271.2024.02.18.13.22.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 13:22:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70589-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=gh+L60t0; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-70589-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70589-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 388DA1C20CE9 for ; Sun, 18 Feb 2024 21:22:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3C8847318A; Sun, 18 Feb 2024 21:21:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="gh+L60t0" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 29EE67318E; Sun, 18 Feb 2024 21:21:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708291315; cv=none; b=b1Hr0owJ8sgieo9pTGk3lSWUgy0aoRRGZIfTUpMGB6aQZPGp+Euf6m50bjDRtXE/n2L+R516hrrW7tEZr5W8zqzRrTke+kaoi9pvsLPR2tH/CMWlQOvpSSDiCFHF6UcYcvJ4N0sOj1wOXDp9pE08bfN3o3yIeRRPMP4uXO31u1c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708291315; c=relaxed/simple; bh=nviFZpkKKCzEebEAPc9U0aKPoo1ClU+opQSf18ATb8I=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=gqRjFkKUXOGSRTJSKcDR6+JLq/FgwmrCTMlvU4mLOp8afKZtqMpxQrg1WPym6FI2GveEJ1u8skw9ME5w/YKHEVoaYCwtnLekKNuEQvFXUwNOAk9y/+3riqlSYtrXDKCWqtQOaAqgCMC+x3hryZpSJIlkpYA1dbnO+I3ao0OIth8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=gh+L60t0; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D6E5C433F1; Sun, 18 Feb 2024 21:21:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1708291314; bh=nviFZpkKKCzEebEAPc9U0aKPoo1ClU+opQSf18ATb8I=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=gh+L60t0itXnW1+QDWGY1bz2tANjs2sIwKyWszurYv+kCgTWgx+l9sOyd6OGf8Qe8 dEVr7ppgio4xtfjfwO7E6JXEMVHEnPLKzWjpodug9un77PTxXf2FbItNSKq9XqbYJA CVPlsZgjd2mbWAyIkBX254z4YeF1hQwPMsn9XYUY= Date: Sun, 18 Feb 2024 13:21:53 -0800 From: Andrew Morton To: Changbin Du Cc: Luis Chamberlain , , , Xiaoyi Su , Eric Chanudet Subject: Re: [PATCH v3] modules: wait do_free_init correctly Message-Id: <20240218132153.d93675d0d241f021565a08b6@linux-foundation.org> In-Reply-To: <20240217081810.4155871-1-changbin.du@huawei.com> References: <20240217081810.4155871-1-changbin.du@huawei.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sat, 17 Feb 2024 16:18:10 +0800 Changbin Du wrote: > The synchronization here is just to ensure the module init's been freed > before doing W+X checking. But the commit 1a7b7d922081 ("modules: Use > vmalloc special flag") moves do_free_init() into a global workqueue > instead of call_rcu(). So now rcu_barrier() can not ensure that do_free_init > has completed. We should wait it via flush_work(). > > Without this fix, we still could encounter false positive reports in > W+X checking, and the rcu synchronization is unnecessary which can > introduce significant delay. > > Eric Chanudet reports that the rcu_barrier introduces ~0.1s delay on a > PREEMPT_RT kernel. > [ 0.291444] Freeing unused kernel memory: 5568K > [ 0.402442] Run /sbin/init as init process > > With this fix, the above delay can be eliminated. Thanks, I'll queue this as a delta, to be folded into the base patch prior to upstreaming. I added a Tested-by: Eric, if that's OK by him?