Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2595107pxa; Mon, 24 Aug 2020 20:02:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtplKfhvMthLR+gVlWBU8kJXTeVV0pFFCjY+8WlJE1Q4zMJbjaKxCZ51BtqY3+yot3+3Aa X-Received: by 2002:a50:f312:: with SMTP id p18mr3987028edm.216.1598324550786; Mon, 24 Aug 2020 20:02:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598324550; cv=none; d=google.com; s=arc-20160816; b=MuxRERkqL0wzZ//h7JPqUg4Eee6dmQntmhHfaqXgWs4U9wHdLihnki48fcT6/rPM1K faK6CBkl8re1BSS5CoYABfUnQtoKOHGWx7jeDLT8yx7GEmk7r0CqrDyb8NcsoBcpWWmN uk6SleABv0pwFQT4DJ7x8CHFIveeQHjDLW0LBqaytAO9TU41K858y2C/dJhWDyHSQzZ0 QAceHqZMnrjAfH6h6awBT2g1+TKUqXWQqzIN7GXIPyIGb6P0QcfWljJuxFMLq4OYWntJ RTbKjXaT4KEcxG+ps3ReJ7F1OyepWAo5mVZlRrvjpZx+xh9qoG2E59CqVy9DNORoZJr6 GuLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ZysaSI5yV1FqGvE2KQYGBQnhBGkYceVPyQn+o+Qr/5I=; b=oCtL8tVIhUwoJSbpFiL1+6wNS+oVT8bmK/9/K+RH/FioNqU76nnMjWs5Rpc3NcBTlO gmV+lwfcHkJoWO7KIniZ1waueVab8g+CdcHTZLB+Qu5+93HKMO8NPfRdiglLv6mCskjD xCelhwAXuxks2BBkUTb1Kxrw6dXuCbcgmiG2Hzv/a4SRC28TlTNG5CY4LaOSbblVnVCy yJZr9y0fbuCHl0LKLf/6qK5iCmDD3y8sbySQWlQUsWE9c1cJoWbhUkCdaYjK6LhepVfY /TORAt/zxLtXI59Y1GqiNcVYXtkiESc0EVESYfI0NpPXRPEmMzEHGtldiupRiOQPcz73 BDaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=MVMfwOZV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f23si2095647edq.169.2020.08.24.20.02.05; Mon, 24 Aug 2020 20:02:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=MVMfwOZV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728210AbgHYCsz (ORCPT + 99 others); Mon, 24 Aug 2020 22:48:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728061AbgHYCsv (ORCPT ); Mon, 24 Aug 2020 22:48:51 -0400 Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DD9DC0613ED for ; Mon, 24 Aug 2020 19:48:51 -0700 (PDT) Received: by mail-qk1-x742.google.com with SMTP id z3so5436977qkz.7 for ; Mon, 24 Aug 2020 19:48:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZysaSI5yV1FqGvE2KQYGBQnhBGkYceVPyQn+o+Qr/5I=; b=MVMfwOZVJRqlGMMh58yzJyBWm78A8XbSB1PnLgjpi6Uv+IuvP5FjtWbuhI2F+5wsAw RvwY+GPvSannr0L3tJ9zPnHqzagYfT6EdR5SgqPRSy1DUHgl3I6D5IRyhxWI9/FAS5KN 0+vSF/cF+91qLlqySeDrydVFY91sPlnwivK10= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZysaSI5yV1FqGvE2KQYGBQnhBGkYceVPyQn+o+Qr/5I=; b=IifNZBbt7klAaA3r204Xqwx+1dNsYKI6pxOWCAgRUVoFsBcjqG8BEBTCsMA1uxNRuE DtIrCdcZfjwE5HT4F/F9WLb1vJ7sV5WUPNL0YRBtNw6ieFV8H04NJiaOWywMp3Rck9DM IIkhby0IAfaqxk9DcJbwg8pxsyMr9IaHGc8EWYPTOSYi0RJKLS1OfcZPjVB4UlXQuq9l KX3O10nSKOqx8/c68Ryu10L/ePl5fHQzH7h/NdGd/7l46ZMkU2ZFxgsRnCGRBs4kLxOe F6ueoEGJ3aCsSYYs4lktcF2N3InqMAUs9v+RD5QS4hbBbTUjkzBL6rPeheotup/SLht5 dHFg== X-Gm-Message-State: AOAM532q7RHc+8RjDqTvcsmflipv+FDG0qAXMQOU/+Ns4u9CBq0Oi7W7 4jeu2z0j/DHNeSCbo4B6yOoBA7BE0N18Ag== X-Received: by 2002:a37:afc4:: with SMTP id y187mr7762698qke.285.1598323730619; Mon, 24 Aug 2020 19:48:50 -0700 (PDT) Received: from joelaf.cam.corp.google.com ([2620:15c:6:12:cad3:ffff:feb3:bd59]) by smtp.gmail.com with ESMTPSA id n14sm2159188qtk.50.2020.08.24.19.48.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2020 19:48:50 -0700 (PDT) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org Cc: "Joel Fernandes (Google)" , boqun.feng@gmail.com, dave@stgolabs.net, Ingo Molnar , Josh Triplett , Lai Jiangshan , Madhuparna Bhowmik , Mathieu Desnoyers , neeraj.iitr10@gmail.com, "Paul E. McKenney" , rcu@vger.kernel.org, Steven Rostedt , "Uladzislau Rezki (Sony)" , vineethrp@gmail.com Subject: [PATCH v4 -rcu 1/4] rcu/segcblist: Do not depend on rcl->len to store the segcb len during merge Date: Mon, 24 Aug 2020 22:48:39 -0400 Message-Id: <20200825024842.3408659-2-joel@joelfernandes.org> X-Mailer: git-send-email 2.28.0.297.g1956fa8f8d-goog In-Reply-To: <20200825024842.3408659-1-joel@joelfernandes.org> References: <20200825024842.3408659-1-joel@joelfernandes.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The donecbs's ->len field is used to store the total count of the segmented callback list's length. This ->len field is then added to the destination segcb list. However, this presents a problem for per-segment length counting which is added in a future patch. This future patch sets the rcl->len field as we move segments of callbacks between source and destination lists, thus becoming incompatible with the donecb's ->len field. This commit therefore avoids depending on the ->len field in this way. IMHO, this is also less error-prone and is more accurate - the donecb's ->len field should be the length of the done segment and not just used as a temporarily variable. Signed-off-by: Joel Fernandes (Google) --- kernel/rcu/rcu_segcblist.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kernel/rcu/rcu_segcblist.c b/kernel/rcu/rcu_segcblist.c index 2d2a6b6b9dfb..b70d4154433c 100644 --- a/kernel/rcu/rcu_segcblist.c +++ b/kernel/rcu/rcu_segcblist.c @@ -513,14 +513,18 @@ void rcu_segcblist_merge(struct rcu_segcblist *dst_rsclp, { struct rcu_cblist donecbs; struct rcu_cblist pendcbs; + long src_len; rcu_cblist_init(&donecbs); rcu_cblist_init(&pendcbs); - rcu_segcblist_extract_count(src_rsclp, &donecbs); + + src_len = rcu_segcblist_xchg_len(src_rsclp, 0); rcu_segcblist_extract_done_cbs(src_rsclp, &donecbs); rcu_segcblist_extract_pend_cbs(src_rsclp, &pendcbs); - rcu_segcblist_insert_count(dst_rsclp, &donecbs); + + rcu_segcblist_add_len(dst_rsclp, src_len); rcu_segcblist_insert_done_cbs(dst_rsclp, &donecbs); rcu_segcblist_insert_pend_cbs(dst_rsclp, &pendcbs); + rcu_segcblist_init(src_rsclp); } -- 2.28.0.297.g1956fa8f8d-goog