Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp257022lqs; Thu, 13 Jun 2024 09:12:52 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW+LCKDrfqw8kwGdYuYjU8QpDCpn36Xr7X7+T8xlh2kdy4kT/+yDpJh5ra3ArN1eBzWPA4JojIBMQoyRDOk7TS55kxR/a/sfGa+NCnxvw== X-Google-Smtp-Source: AGHT+IGDk909cmCeksu8x1gZsj5vughYnQ3ZEdGMURl26wzQdyG6FIj5IMqpNTcHnmiPO8ggIp2G X-Received: by 2002:a05:6a00:1d97:b0:705:964e:d9f3 with SMTP id d2e1a72fcca58-705d711f81dmr141583b3a.11.1718295172284; Thu, 13 Jun 2024 09:12:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718295172; cv=pass; d=google.com; s=arc-20160816; b=uyrbAtb9C2zrwdvD/efPjuQrs3XQGcremYkAv7Vafjus/3UVI1U8RUZu4obsfYRbpS v4j9OlTkqmeUoz30iMLDrRbY2gZRC31IGEtLdnAnmZgIsSueY9c0hIYDbwJW3oyYDaOt 3vFfLFrtXvAk+4yxiK06uVHdkw9WaV5lfOmoQ4KqB2DGySSjraC15zuFYsM7j8Vgvy9T qGxPuQocNxHWTUW4OrMsNOxFU0oRm/JSVtXh9lF/GIu+LOJs5v2RtDOIJDjpDUCWSyD3 WU4P8h8muD5qRHQoOjWbs1fIwzoGfWZ40DpbWla6R1dd42fquBDfg2T+q38UEYL+fXCw S+HQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=jhjoBEixCdgzxQ3iF+r/n1LVF+noWpyI7rGB9WCArWs=; fh=oUgcZ+V2KMhVieDQeKYUyu2iNWeDdSrQKwi60DuWusE=; b=beS1yAotNUKndcl3XG4Em9ahC2IKfikT5qHfADi03cT39RYn5rk3YSoYN+4zXeMyDq oxdnu7beJh6NXgqfGDcV6EiByPfdnAW6zOLaktZoOTzeMtM0X+VPJEyf8taA7xzAztil BzdmDZv/HoXA5LF2+hL0pPp1SS3s10LFQ76NMN6wfMU2QbnKiyWeC4ayF41a02wvdIj3 ixkmGML6FdjW2dmtu7Oy5G9WD3A5NX3hg0qpaPMBAACBNVZ17WXTjV2akxIz4I8mqxbT 9I+JZKPREEyN3ifOZIIrW4JlnJETFuFeDduOiXiuEKMDcfiNCCoMj98zs5tTr9hhpKL4 tExQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BGawiitr; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-213624-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213624-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6fedd4f466asi1589459a12.4.2024.06.13.09.12.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 09:12:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213624-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BGawiitr; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-213624-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213624-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id A0211286D7D for ; Thu, 13 Jun 2024 16:10:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1A66C1311A1; Thu, 13 Jun 2024 16:10:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BGawiitr" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 40805A23; Thu, 13 Jun 2024 16:10:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718295042; cv=none; b=j5U2JMmTLh8Lr7f4rkWZu9lgTpwHDhfS1AO2kx0fpEC/sX0z5WCITcCj0wFUT9iW5TtEabRcTTBqCY10M/YxUwkbjJ2f5vBqQubyS1S8ZbuiUwZcickKZXoj8NF2ZZRhyoOgyBPPPITrIzc2ZU4csJo8p482n5KKARxPKWb3scM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718295042; c=relaxed/simple; bh=hg3ZFX1ZdZkhCBl0cycfGdCXZQ4o5gfmME3tRBWguwM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ij5dOvtD1DwK0BK5c78hukgtG3mK+EQZC2GfrdF842A51a9YMH5m7qxQUX/6HbUPTCHuLXXCEAyJ9RWnvC/L9Sk7IfSkrOyS11bsJ0pCFpfxl4usfuuawXaXTknqJ3JP0iIyTlYrKivwgZuDo49HtFiw0MLk2QkRnxIT9QgK+hQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BGawiitr; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E47BBC2BBFC; Thu, 13 Jun 2024 16:10:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718295041; bh=hg3ZFX1ZdZkhCBl0cycfGdCXZQ4o5gfmME3tRBWguwM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BGawiitrSTl4D4rivmIxK2Oi0t9rHJYvZejrrvqg/cKKXIBd3EO7svZMgXA2PUpzl UP/u0Z0iqXD/ywWs2CrkUjY7ovZAvm0ZJpzDd5aX5Oms9EaHiZLletbxjOsA+4lYbr fwz5YexiuheI88zZR9yQwv0SBnNQipiVQmNTypdNkyt2eVPqRKku+QfV28PKZSAg3m x7MByJYAMGn7iezYywecmd+wUyjXeIbkHtv0YJ/vgYtFPzW2ILqzh4naVVwp2wB/5a Id7suEadAY11JqGsf6bfPQDdlIS53V0a+Esj+8wHpIFZewp/q+0I5/Vlnd+3iH5prr 0TJnH/oMecg/g== Date: Thu, 13 Jun 2024 10:10:38 -0600 From: Keith Busch To: "Paul E. McKenney" Cc: Nilay Shroff , Keith Busch , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, hch@lst.de, sagi@grimberg.me, davidgow@google.com, akpm@linux-foundation.org, venkat88@linux.vnet.ibm.com Subject: Re: [PATCH 1/2] list: introduce a new cutting helper Message-ID: References: <20240612155135.3060667-1-kbusch@meta.com> <31eb40f9-d68d-4348-b1fd-3cf057939297@paulmck-laptop> <73b994eb-c689-48e0-b09c-a414041a0525@paulmck-laptop> <046f42c5-34b5-41a2-9680-5ef86ef25c01@paulmck-laptop> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <046f42c5-34b5-41a2-9680-5ef86ef25c01@paulmck-laptop> On Thu, Jun 13, 2024 at 09:01:47AM -0700, Paul E. McKenney wrote: > > Is there a way to avoid this issue by making this be a statement parameter > to a macro? Something like this? It appears to work for the intended use, at least. --- diff --git a/include/linux/rculist.h b/include/linux/rculist.h index 3dc1e58865f77..cdd2e5c0d5cdb 100644 --- a/include/linux/rculist.h +++ b/include/linux/rculist.h @@ -204,6 +204,30 @@ static inline void list_replace_rcu(struct list_head *old, old->prev = LIST_POISON2; } + +static inline void __list_cut_start(struct list_head *list, + struct list_head *head, + struct list_head *entry) +{ + list->next = entry; + list->prev = head->prev; + __list_del(entry->prev, head); +} + +static inline void __list_cut_end(struct list_head *list, + struct list_head *entry) +{ + entry->prev = list; + list->prev->next = list; +} + +#define list_cut_rcu(list, head, entry, sync) \ + do { \ + __list_cut_start(list, head, entry); \ + sync; \ + __list_cut_end(list, entry); \ + } while (0) + /** * __list_splice_init_rcu - join an RCU-protected list into an existing list. * @list: the RCU-protected list to splice --