From patchwork Wed Apr 5 02:26:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Chamberlain X-Patchwork-Id: 13201110 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 235C7C6FD1D for ; Wed, 5 Apr 2023 02:27:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B0DF06B0074; Tue, 4 Apr 2023 22:27:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id ABE01900002; Tue, 4 Apr 2023 22:27:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9ACAE6B007B; Tue, 4 Apr 2023 22:27:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 87C416B0074 for ; Tue, 4 Apr 2023 22:27:18 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 5C9321C6854 for ; Wed, 5 Apr 2023 02:27:18 +0000 (UTC) X-FDA: 80645750556.09.4A6ECB4 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf24.hostedemail.com (Postfix) with ESMTP id 352E2180011 for ; Wed, 5 Apr 2023 02:27:15 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=Fdz2wgwV; spf=none (imf24.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1680661636; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Uqmhy/9B7e+b9++KAwscH/EUKyozA37q6pM2lTfdg70=; b=EEuP/PRW5Yk+21+RRgOxwdc2ofoMmAqKYANfEEpP6dVFT+6/DDDcloIcmjnv4HvIZR3TlD UqVp13ZqP4eVHL4+DYmCdSblASiCEgpRJXsxnhUaFuSsXJ/2VWGMDbCW1dN26SVsoy16Ax +LXZjLKBtU0gCyzSb/VStUcQhJTboz8= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=Fdz2wgwV; spf=none (imf24.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=none) ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1680661636; a=rsa-sha256; cv=none; b=LRraJ8NoyCwsktEUixNEbwVVHIZ8gi/guswhujNq3OZ6kf/6EYwBz3Oojw81OKoRcnVETW NxvbeiDnvSuumu5JKYbQ8+vJNWu2NeNbHFav7SFLJY81+T8QjJutSF5/UrALmETDnMGJWu k+oKCMttkWKMIvhNQ4NBp7fcnxJy2d0= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=Uqmhy/9B7e+b9++KAwscH/EUKyozA37q6pM2lTfdg70=; b=Fdz2wgwVgvdRKm6Kqj5WWQtJhA Nr1fqb2X4v2AY1i9kpKnf8cC7l+kYK/BFJTZPMjM/cFEx9jprMFVQ+FeMRZ5jUn2FmJRPgw00k/1C QCCZh/fUboJuUiuLlPl5wPHbkMMOTiloaemmfC8O5qmlxX39PnvQNHpa1R1Wvtk5tg28SmlJopNKC XhB1USGVZC5MbSb0RT98TXoDFNuFIur5f7FfMS1Laba7pQL7MLi9xYEu3L2qvCbQwr1kDT8pEepmO 3pmUtldAXo4ND8BROJDvFJqbbWxGNZBaHAXTFIOmv8pmlmwz2y/fPaUnh5u/DbH4qDCa9qTxjoR1E RawITC0A==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1pjsrb-003A0L-1g; Wed, 05 Apr 2023 02:27:07 +0000 From: Luis Chamberlain To: david@redhat.com, patches@lists.linux.dev, linux-modules@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, pmladek@suse.com, petr.pavlu@suse.com, prarit@redhat.com, torvalds@linux-foundation.org, gregkh@linuxfoundation.org, rafael@kernel.org Cc: christophe.leroy@csgroup.eu, tglx@linutronix.de, peterz@infradead.org, song@kernel.org, rppt@kernel.org, dave@stgolabs.net, willy@infradead.org, vbabka@suse.cz, mhocko@suse.com, dave.hansen@linux.intel.com, colin.i.king@gmail.com, jim.cromie@gmail.com, catalin.marinas@arm.com, jbaron@akamai.com, rick.p.edgecombe@intel.com, mcgrof@kernel.org Subject: [PATCH v2 2/6] module: move finished_loading() Date: Tue, 4 Apr 2023 19:26:58 -0700 Message-Id: <20230405022702.753323-3-mcgrof@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230405022702.753323-1-mcgrof@kernel.org> References: <20230405022702.753323-1-mcgrof@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 352E2180011 X-Stat-Signature: jje6gd1fmj913r899j5qcxembnkz7xhe X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1680661635-99448 X-HE-Meta: U2FsdGVkX199eCgKmGuj0oIjh6p9luCoEUxMG94GbSEL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ab4/r3GRursXds7szCahOOOPho5E45eNV0T7oHja0Obo9GxZ6fRtt/Rnmy2ngFI0Dh1mXPg4m4+WDXLSosmuQClPmQi8CVHe/xtnbsrTNk25kVKPFZq/sM7EUQ93Qagt6CiFunUAgZYG+0Sj7L1222WnR31sjR/qA7LBjOkyJIkuOKC3YeeOtANG9ZPpT5MDyAPXDuVZ8ULWYoMHh1ppF7TyUDRzu8qcNDgI1dx40Ni6Q2o12fKQ3Kf5dRTn7DutoXCsBS74eaWb46c2d+/BO/+NbZwHygSrldcwJKOocOykPkC4d5dU9BEyeW9sVeeukzyNYJTAKIZXyc3NC3w0sqSV//BlgyAuyAw+bn8KE87djDwMCASv97m2SIHp5zruZl6rj2pUQtR/xr9ZNHQwImWlNxw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This has no functional change, just moves a routine earlier as we'll make use of it next. Signed-off-by: Luis Chamberlain Reviewed-by: David Hildenbrand --- kernel/module/main.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/kernel/module/main.c b/kernel/module/main.c index d8bb23fa6989..98c261928325 100644 --- a/kernel/module/main.c +++ b/kernel/module/main.c @@ -2454,27 +2454,6 @@ static int post_relocation(struct module *mod, const struct load_info *info) return module_finalize(info->hdr, info->sechdrs, mod); } -/* Is this module of this name done loading? No locks held. */ -static bool finished_loading(const char *name) -{ - struct module *mod; - bool ret; - - /* - * The module_mutex should not be a heavily contended lock; - * if we get the occasional sleep here, we'll go an extra iteration - * in the wait_event_interruptible(), which is harmless. - */ - sched_annotate_sleep(); - mutex_lock(&module_mutex); - mod = find_module_all(name, strlen(name), true); - ret = !mod || mod->state == MODULE_STATE_LIVE - || mod->state == MODULE_STATE_GOING; - mutex_unlock(&module_mutex); - - return ret; -} - /* Call module constructors. */ static void do_mod_ctors(struct module *mod) { @@ -2638,6 +2617,27 @@ static int may_init_module(void) return 0; } +/* Is this module of this name done loading? No locks held. */ +static bool finished_loading(const char *name) +{ + struct module *mod; + bool ret; + + /* + * The module_mutex should not be a heavily contended lock; + * if we get the occasional sleep here, we'll go an extra iteration + * in the wait_event_interruptible(), which is harmless. + */ + sched_annotate_sleep(); + mutex_lock(&module_mutex); + mod = find_module_all(name, strlen(name), true); + ret = !mod || mod->state == MODULE_STATE_LIVE + || mod->state == MODULE_STATE_GOING; + mutex_unlock(&module_mutex); + + return ret; +} + /* * We try to place it in the list now to make sure it's unique before * we dedicate too many resources. In particular, temporary percpu