Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp370449rdb; Thu, 22 Feb 2024 06:25:28 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXpN7U7T0v4BCv3c7AUbbB49/kBU6BCWku9zZQVLsd+SNg9zWaQ8HZFZa4C+7919S3ahekEV3dW2gPrHAtpc2CeQacUmuy81mHvlINL1Q== X-Google-Smtp-Source: AGHT+IEF+pIw/giOtBTeckDv+FugK2UgVdx3t6BBZpwYRPA7C+UtApOZ87bDB+yMtGXeonxrSsGr X-Received: by 2002:a17:90a:ce09:b0:29a:6086:a8f8 with SMTP id f9-20020a17090ace0900b0029a6086a8f8mr645430pju.16.1708611927997; Thu, 22 Feb 2024 06:25:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708611927; cv=pass; d=google.com; s=arc-20160816; b=dfVOGmxs3Ht3XAcyZfb7Hz0Ywu+inSUyVXuHkoyopPV9kCnmyjMsEoANjMrTUgTOnm gaCb2cAw21kA6+ig5Ci7OYNb/aVo3tMWyNYaVo6zSIIkfBGGU5B79SbTeugjrOW6bCCe yG9shLJvRKXSInlvGpBR+syv6wH8vt2K0ZOUotoOYpZzE/o/F+l1qYA50h40W4A1sBNr 3YEh6vLoTQo+H/w1iOGq0IIcNvx3d/JuFJh0Revr/bCr9Kl0wOqwkcATixvg47MRtUrV ZzbaWZdMYDgU8h1kwdWp0FemJL0t2Y1TU+pba7frWl1cEqOcW5SdwBgr8tKFSv2PwF++ oOrA== 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 :date:subject:cc:to:from:dkim-signature; bh=P5dkM7DuGNd3n4uTkQacavwzunNC39kM4edC7ugWujE=; fh=yRWAnXCrDeo1JkXV9iUtee7xVlLig8radlX7vPmVxyI=; b=dSqSxf9UGm90IbaFJzVRVRt2flkAh9T9hEPy0Eyr6KF6g2gIf/P15w6Jxx7YsnN7We kTHt5O7d2kkbcMftALTKxBehzYj1POLbWoHI4O2XaQ6pqGeNHYGDkXT3/rVt0hwkJrS/ gcGp1pvv6JrNDtmYTHjrRMwhUv5l7hKKwsb2RXrTf9rJoMnG76f2RxULzYEZtk+GFpVK r6UF/w2DqKzx2hNj0uudQ5wiNoKB+IOvHkT8+MktsBNANIRA3J6tK4BR/7eSp4QXqNjG hqAdiIbsvcmaGShJtRxNBqZtr6JyUGPGxD2jRMa9+8BBnrqZC74Vh3rbUX6LSIHmJCYv Y+7A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=EWql7fnc; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-76666-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76666-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id s19-20020a17090ae69300b00298db280de8si3631587pjy.29.2024.02.22.06.25.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 06:25:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76666-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=EWql7fnc; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-76666-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76666-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id F360FB26C9C for ; Thu, 22 Feb 2024 14:06:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D23A11474A5; Thu, 22 Feb 2024 14:05:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="EWql7fnc" Received: from out-170.mta0.migadu.com (out-170.mta0.migadu.com [91.218.175.170]) (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 A1D9914691D for ; Thu, 22 Feb 2024 14:05:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708610704; cv=none; b=MUmDAnjJIzS9gCr+IdbGtoE2mu1pcxAxlvnPgaRdkxfatUrfIR0ya3/n2AXwDnz9ojDgeY/crV3BKuH4sXHgJc0snouJSU/mpAUlp6lLeu3lslH5sfHj4fJ/VNEAwPoZ9Cf+8HMj1N2fqx+Cx9ZYWCblJDqSdYKmZY4MbdDfa4g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708610704; c=relaxed/simple; bh=tQai8VYTD5u9kmna2i0v3NDlggEePdlk6wRlzITeLz4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QU38ab7YDD8SNlGQvhTp+iagjGHdS1muUUjfHjXxfIHPvemrFFJKk4VQLAR3ENbrsKjrM2hHs6hXace8b0eB8XUjwFUjTEAxBspVm0ZTzMf8uT3FufhanKsbn9WYF63VXtxo/4vNO2z3GSWKPOWL70oObWnWPOwhOpYiAbdJPvQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=EWql7fnc; arc=none smtp.client-ip=91.218.175.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1708610701; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=P5dkM7DuGNd3n4uTkQacavwzunNC39kM4edC7ugWujE=; b=EWql7fncR1Nj1MIpD5GRXCTp3WENf4dEY69tv+jJU3JilH4N5PjL/V0Pe5FGwckjEP/Uyc TMSelN5Z8oMXIJ4mqBgNDiz4LmUYpAOxzwz8N/sBA/f6cjS1ksHyDB50z50WXk6Wjh9xGP vTIbBboABNWUcFmQwXUyWrABeLtlfvs= From: Gang Li To: Andrew Morton Cc: David Hildenbrand , David Rientjes , Muchun Song , Tim Chen , Steffen Klassert , Daniel Jordan , Jane Chu , "Paul E . McKenney" , Randy Dunlap , linux-mm@kvack.org, linux-kernel@vger.kernel.org, ligang.bdlg@bytedance.com, Gang Li Subject: [PATCH v6 5/8] padata: downgrade padata_do_multithreaded to serial execution for non-SMP Date: Thu, 22 Feb 2024 22:04:18 +0800 Message-Id: <20240222140422.393911-6-gang.li@linux.dev> In-Reply-To: <20240222140422.393911-1-gang.li@linux.dev> References: <20240222140422.393911-1-gang.li@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT hugetlb parallelization depends on PADATA, and PADATA depends on SMP. PADATA consists of two distinct functionality: One part is padata_do_multithreaded which disregards order and simply divides tasks into several groups for parallel execution. Hugetlb init parallelization depends on padata_do_multithreaded. The other part is composed of a set of APIs that, while handling data in an out-of-order parallel manner, can eventually return the data with ordered sequence. Currently Only `crypto/pcrypt.c` use them. All users of PADATA of non-SMP case currently only use padata_do_multithreaded. It is easy to implement a serial one in include/linux/padata.h. And it is not necessary to implement another functionality unless the only user of crypto/pcrypt.c does not depend on SMP in the future. Signed-off-by: Gang Li Tested-by: Paul E. McKenney --- include/linux/padata.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/include/linux/padata.h b/include/linux/padata.h index 8f418711351bc..0146daf344306 100644 --- a/include/linux/padata.h +++ b/include/linux/padata.h @@ -180,10 +180,6 @@ struct padata_instance { #ifdef CONFIG_PADATA extern void __init padata_init(void); -#else -static inline void __init padata_init(void) {} -#endif - extern struct padata_instance *padata_alloc(const char *name); extern void padata_free(struct padata_instance *pinst); extern struct padata_shell *padata_alloc_shell(struct padata_instance *pinst); @@ -194,4 +190,12 @@ extern void padata_do_serial(struct padata_priv *padata); extern void __init padata_do_multithreaded(struct padata_mt_job *job); extern int padata_set_cpumask(struct padata_instance *pinst, int cpumask_type, cpumask_var_t cpumask); +#else +static inline void __init padata_init(void) {} +static inline void __init padata_do_multithreaded(struct padata_mt_job *job) +{ + job->thread_fn(job->start, job->start + job->size, job->fn_arg); +} +#endif + #endif -- 2.20.1