Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp461866rdg; Tue, 10 Oct 2023 16:08:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEqcdK8l57hemYUXnofPMMXxcyOkg5elACvtA4uYuLsI16DckwKY+1PVX3TM1iPMa4q0gXE X-Received: by 2002:a54:440f:0:b0:3a7:73e0:d18f with SMTP id k15-20020a54440f000000b003a773e0d18fmr18629543oiw.14.1696979301908; Tue, 10 Oct 2023 16:08:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696979301; cv=none; d=google.com; s=arc-20160816; b=EXG99HPv+H150hXZfTzYPcwcvjkWjBOVAZoOkSleWw/m/lhrOI6kqOTZSsPD4DtBMW /uCu7Kc+OhcHqEgxhGoarJB+9k1EES67xqnUr2+XiCAGeQal62bCHhgQrPD7Z9EGVpWv vxlJXcHAwXOfqxM+ZSkxA+ZTvt1b/lgh/9Aldhdpcjqpb1pacGdIoZOOQvFoyeIQeaxQ dfCwyKrbW3ceQAXHtKqKO1lV8lPfO41GXFSpfo9xWLMbV54/obn2KAfof7EdHHxnwWft lhKOaS+v8Jd0vGjAYqqFsgX87YA2FwgqSQPf5SQ8laqKzEckKyukVas4S6s8iDChXQjp c05g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=qkGehZf05dSaZaQ9Zw15qdPyYFyDKIe1tlJJ6Hrr4eM=; fh=kEGww3qdUnkGPCsR7gpDk5YLS5t7Rauod14IJ/T9V8w=; b=B72W+4gdhzAmteKajHH/xm5Zb5NKIn+c/R9DinCwnlNZ/R3OsMvbbkXZUH4mj3XxcG tBDAmiYJU3rCypFLWbo9gNc8kLlgG3TDk4secTqc+ijmfHQvHjMRTr6+5hhb7S/oIGC4 PeRnkBsKPeTvVuyrPFmQmxCqN1IRmXSuBom9YuHGt2LymOFV3LJkYR2iUns7uDGej3AB /zQ2enKpY9ctGTQ4+PP9XEINynE3iLZZ2IJBCQR1iSJmAcpli+Nhsi+9pmvz94Aqw037 /f6/BK1Ty69kyCAhfXRuHnpCk8yFEctoUnVF2GmySdzbV5+bXoiXbJW8hEBp5J4amCYf 2hTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fZSXJY8X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id d1-20020a63a701000000b0059cdf90b9b2si1888575pgf.685.2023.10.10.16.08.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 16:08:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fZSXJY8X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 37DEA8022B3E; Tue, 10 Oct 2023 16:08:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231452AbjJJXIH (ORCPT + 99 others); Tue, 10 Oct 2023 19:08:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229887AbjJJXIH (ORCPT ); Tue, 10 Oct 2023 19:08:07 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E5489D for ; Tue, 10 Oct 2023 16:07:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696979239; 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=qkGehZf05dSaZaQ9Zw15qdPyYFyDKIe1tlJJ6Hrr4eM=; b=fZSXJY8XU+M+5yBbi5R0Tw7B2uzscDRbE3p3fWNa9eSnEd8bfqEwNruVj8vNfR/EAOtZ3A WKQk7RbCSETAXbGT6559RM/bvlIcSAUMY7xcxpYUZfQEpasbkYAUslH1swh8b5UwOf+lNQ So3aXdbgg9LSaTlBPT3o0PsjnMtEFis= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-466-zdL2oxNmOvmaPHdlur2yng-1; Tue, 10 Oct 2023 19:07:06 -0400 X-MC-Unique: zdL2oxNmOvmaPHdlur2yng-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 907018007A4; Tue, 10 Oct 2023 23:07:05 +0000 (UTC) Received: from [10.22.9.34] (unknown [10.22.9.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id 43856492B04; Tue, 10 Oct 2023 23:07:05 +0000 (UTC) Message-ID: <535dd61c-8e3e-103c-e970-2c8514af5596@redhat.com> Date: Tue, 10 Oct 2023 19:07:05 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Subject: Re: [PATCH] locking/osq: remove spin node definition from header Content-Language: en-US To: =?UTF-8?Q?Thomas_Wei=c3=9fschuh?= , Peter Zijlstra , Ingo Molnar , Will Deacon , Boqun Feng Cc: linux-kernel@vger.kernel.org References: <20231010-osq-header-v1-1-d68fbc1bf1cf@weissschuh.net> From: Waiman Long In-Reply-To: <20231010-osq-header-v1-1-d68fbc1bf1cf@weissschuh.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 10 Oct 2023 16:08:19 -0700 (PDT) On 10/10/23 05:53, Thomas Weißschuh wrote: > This structure is an implementation detail of osq_lock.c, and there are > no external users. > > Also drop the redundant overview comment from osq_lock.c. > > Signed-off-by: Thomas Weißschuh > --- > include/linux/osq_lock.h | 5 ----- > kernel/locking/osq_lock.c | 9 ++++++--- > 2 files changed, 6 insertions(+), 8 deletions(-) > > diff --git a/include/linux/osq_lock.h b/include/linux/osq_lock.h > index 5581dbd3bd34..ea8fb31379e3 100644 > --- a/include/linux/osq_lock.h > +++ b/include/linux/osq_lock.h > @@ -6,11 +6,6 @@ > * An MCS like lock especially tailored for optimistic spinning for sleeping > * lock implementations (mutex, rwsem, etc). > */ > -struct optimistic_spin_node { > - struct optimistic_spin_node *next, *prev; > - int locked; /* 1 if lock acquired */ > - int cpu; /* encoded CPU # + 1 value */ > -}; It is probably better to drop the MCS like lock comment here as it is not relevant without the optimistic_spin_node struct. > > struct optimistic_spin_queue { > /* > diff --git a/kernel/locking/osq_lock.c b/kernel/locking/osq_lock.c > index d5610ad52b92..918866edbc30 100644 > --- a/kernel/locking/osq_lock.c > +++ b/kernel/locking/osq_lock.c > @@ -3,10 +3,13 @@ > #include > #include > > +struct optimistic_spin_node { > + struct optimistic_spin_node *next, *prev; > + int locked; /* 1 if lock acquired */ > + int cpu; /* encoded CPU # + 1 value */ > +}; > + > /* > - * An MCS like lock especially tailored for optimistic spinning for sleeping > - * lock implementations (mutex, rwsem, etc). > - * > * Using a single mcs node per CPU is safe because sleeping locks should not be > * called from interrupt context and we have preemption disabled while > * spinning. We should keep the MCS comment here. My other suggestion is to put the structure definition after the comment. Other than these minor nits, it is a worthwhile cleanup patch. Cheers, Longman