Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp151737lqs; Mon, 4 Mar 2024 19:25:29 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXS1QZ/LuqgBmmOhJdl2jys4eCVDPUkN8wP7yEB1fXGrRgEeiIjAwkrsct5y3xugYTGFGz8KCuB9HwVSJaF4Ehg981DybgPzNvn2K+sSw== X-Google-Smtp-Source: AGHT+IFXhyuJXJtIhXKF3x9xpTvHDRBxCd9Lx5z3L8iPKhM6Ds3RGzB0WQlYYlkJ3BMckVVPsYYh X-Received: by 2002:a50:cac7:0:b0:565:ebf2:a257 with SMTP id f7-20020a50cac7000000b00565ebf2a257mr7734056edi.19.1709609129044; Mon, 04 Mar 2024 19:25:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709609129; cv=pass; d=google.com; s=arc-20160816; b=DumcmG+L7u6axETGsyFEGWBMoMVXdFuoes5c4GeaEObuHhyTpSbAF5rjTCjBolAwI1 Ib1rZbuJoIRwisYanB15UrIHMAuh+R0cb3dwjz4uBlLpkPLxys163QKw4ZjL6p3OaQok fRKp+pbH+ZICsPPZw9lZd4AqcVJKg5ksCF4xiqBU1spX6Ma9NwJKmuqzZF9/VfDsSCpG NvZeBsDj1RXHI9zs6TIz0otE+u1eXD0WWr9t0Xc4cgaI2EYqdxWZzbZQEf3CFj04cUOW dqXbmn3rLDaIPEBbfqPM/GQvwxX9oMsypCnoMM2jpBU7E6fqsBULpFqEqb6sT2pcBUDn 1GWw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature:message-id; bh=cRrL6EqVu6yE6KYElhVy5I/FMc5x+oybPMPkGTsdsZs=; fh=MXGmJ648mhE0nCg4XocPPenAVykMe/6LToJ3dw56kA0=; b=tbe4lx4CRoYznGxhhdNNpZ5CUojF1b6Syd0k7nX5oJW9rvb2LYunDGqc+ydVveSmws O4As3C34XT0kaJ0IVIcSTo7KDtigxf407xaL5FUJfl2oLKASOjoMffk1crbUg2LOwGGA UGDTgJkLWUxjcWMcFkHZ2YLL7b8YsGSMv/XSSHpgCDqYuK23xSdAgniVVY7jcVXwwL38 EpPVdxTMGeWCw4QqUL+YTPzyn8FyMwbROu7sNz5hYJhN4y1/JiqAiQOp1Q10LEF9mtei anpu58jkCnVsjYkVX4HF9onKvqsif/cNM+ODFFw1iltiKu3RWuMR7/PDuENyOy44r9dm i0WA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=JCR3sWbx; 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-91609-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91609-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id x30-20020a50d61e000000b00564470ecac8si4680741edi.310.2024.03.04.19.25.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 19:25:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-91609-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=JCR3sWbx; 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-91609-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91609-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 am.mirrors.kernel.org (Postfix) with ESMTPS id C24DE1F2301D for ; Tue, 5 Mar 2024 03:25:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 70B2033CD2; Tue, 5 Mar 2024 03:25:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="JCR3sWbx" Received: from out-178.mta0.migadu.com (out-178.mta0.migadu.com [91.218.175.178]) (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 056E12F44 for ; Tue, 5 Mar 2024 03:25:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709609122; cv=none; b=K61xK7l4tjq1aMffVhJeKOeEwDlpZB6iof3LrecHqYvjpeMCp0+eDm1HVyo4sk0rIheBHW5fPPpOIZ44dwNIxnZIhDaOUd2Eo3dyRZG0qo6O1d1wuQ29rFFWRaiEZqIIaQRM6hr4vN6CO294KAMVtbTuyBf36RANpKpkWp+xNMU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709609122; c=relaxed/simple; bh=o4YaCqksKqFYoqSktiTk2QSjD3WdyyaqkHgxXL+uZgQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=cNIQ/FF055pqmsmIIM567RpxsGBF10a5FPUnQ17C8swgHHfDGZNFxPFrWdlx5ZwpFhRFyZcBqbamieyACcAWEs7XugGJ5gV/HMXPpGUvh9FJB9ci6mH/aGXrXbrPJY0nIy9OulGbLOAw4Cg1xxruy7Dah8MbkTA63h6ESJ+9Hws= 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=JCR3sWbx; arc=none smtp.client-ip=91.218.175.178 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 Message-ID: <632e7fa2-1c46-4b78-a407-9e6b9c410ea4@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1709609117; h=from:from: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=cRrL6EqVu6yE6KYElhVy5I/FMc5x+oybPMPkGTsdsZs=; b=JCR3sWbxa4Mfxla52f+nQyNHwsddGamu6M14Ar54Fsqsf4i1XkDu1JahuGuov03wdckqL7 UJaYi+Fgj1VRT0TBJGBHIkD26Gns1fR20vAOltgOWFRdp2B2p/rFJRtz/8t7bhqQpReOP5 wZQPWVIusT97e+6+tJq3xdwLNif78Ig= Date: Tue, 5 Mar 2024 11:24:44 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH v6 5/8] padata: downgrade padata_do_multithreaded to serial execution for non-SMP Content-Language: en-US To: Daniel Jordan Cc: Andrew Morton , David Hildenbrand , David Rientjes , Muchun Song , Tim Chen , Steffen Klassert , Jane Chu , "Paul E . McKenney" , Randy Dunlap , linux-mm@kvack.org, linux-kernel@vger.kernel.org, ligang.bdlg@bytedance.com References: <20240222140422.393911-1-gang.li@linux.dev> <20240222140422.393911-6-gang.li@linux.dev> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Gang Li In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 2024/2/28 05:26, Daniel Jordan wrote: > On Thu, Feb 22, 2024 at 10:04:18PM +0800, Gang Li wrote: >> 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) >> +{ > > An early return here for zero-sized jobs is consistent with the > CONFIG_PADATA version and avoids hugetlb_pages_alloc_boot taking a lock > and flushing the tlb when there's no work to do. That's reasonable, thanks! Since it's single-threaded, the lock isn't contested, but tlb does need to be treated with caution. > > With that, > > Acked-by: Daniel Jordan > And thanks again. >> + job->thread_fn(job->start, job->start + job->size, job->fn_arg); >> +} >> +#endif >> + >> #endif >> -- >> 2.20.1 >>