Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp568918rdb; Sun, 18 Feb 2024 01:24:05 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWqBG+DcOCuiIKmDIcqgV4EBb/k/eZ4IhisrGxKy6gL3YOCiGFzAVMDiaKxw/0WOMdkoXBen4KG3OUa25xeVnTMWUZUhANWOP9amdLZRg== X-Google-Smtp-Source: AGHT+IGzOUVsxye6UsdIMnhe9DEzymbmzWwNqZB5JKHjANs9D5YdFUL437p/Ey0V22x8gFZsuW2t X-Received: by 2002:a05:620a:244b:b0:787:6212:26c9 with SMTP id h11-20020a05620a244b00b00787621226c9mr772796qkn.22.1708248245036; Sun, 18 Feb 2024 01:24:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708248245; cv=pass; d=google.com; s=arc-20160816; b=pYpFSPAWkGmrelom+oecX0MOmwARgJwcdJvq0/uFwSMdVkKbQ6MtXcTl5RiAKW+gOG tdlMiR4ZiTEZWU9RfKDlrLzeMxUdXB7tG8hnMdfWP7Y2tPT8t9fyy3KNmnYOHSy4usuW rVYDx8ybED5NxZt34SIfF1WeJOP57lT2BbEYXZTmSqW8pS55fQ1T/3AtOkAP4czI9JGA NwNBFzxVJmY1CmWB5C7okXfPs4l09xssd7C/k5eMTen3v00U8CCh6RWh9goVqCazfu42 kAdb1ti7LqgSbyHeydySVOeKs1thpXBIZY+OhtseS7o4H9RI7fxo185TT4UWtT50OjAV feUQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:date:message-id:from :references:cc:to:subject; bh=QbLih0vA/xFKWXJ89ViDxaXFWUOtNST2kUgP7yutAac=; fh=jMSQj+Bk8F21KEOlR6gJuEjWMGxb+2Qn7PH939AEFS0=; b=bEEIjiq2xdDpBZbYe/gK461N/8WsHGFONl6dobCYT9G6ZfhuQPTge6LD2Gk09JHmNS +lijxwheDI6V+1qo6IOWq79utKpQxSwY3osGtnotoDBua3MFMlkQMEl+whxafoZbtHzx ub/rf1MqWEFY+1lpvfdkSG7HDaKO0Gj5EtHrMM+/15YRpjEwVnDPCZhDbyZLyjYP1EBw aSzEWu3BBg7ksrFF1dsixeEeBmqre+dmzdiZ+p+WjFJHkhyBGZZNboydKWvlIinjAo7b r3QuQJpeOyT9uzcx9PHELreeTNTiUbsPAcRIEeqpes5eAGjdJhnkI7GOooA0ghl7MLdu b9zA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-70314-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70314-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id a12-20020a05620a16cc00b007871f95a1f8si3790938qkn.723.2024.02.18.01.24.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 01:24:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70314-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-70314-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70314-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id C267C1C213EB for ; Sun, 18 Feb 2024 09:24:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 28CC512B91; Sun, 18 Feb 2024 09:23:59 +0000 (UTC) Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) (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 6070BD52D for ; Sun, 18 Feb 2024 09:23:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.32 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708248238; cv=none; b=c4Tf7anrls0ZOMzEnRV6cVnTfmC8pdNGpAYdtrC1sDVSMAsEzv9463r+dXIqeaPSqH3DD1GJQlap3VXgpN7SKaqnyDqKEF7Of9gXXxPO4J4XyH5AbRkDdAp2Smk5873MRvgHabSsEb+0hznNiK3j3HJ1tTuTgfwLWdo6bwtSJpc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708248238; c=relaxed/simple; bh=RkxEEuAcGz7HmYPDbOec7jZ0vGmJiptdvXmqCAGDlRk=; h=Subject:To:CC:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=XnO7ZqX7IgLAAlutAfF2MgB/os1lizkIGevo5dymnzsKo/rNFAgsmNYmRmSB8wdWQCfPEcS7Y3hYtFi96sPWoLhyc8Hd03jpIWB1XyLegBC9pFnLrTqlsZuEJ72eHoi50pXbPaNGHf0yoeRuSE9jCfbouCR21QvAjGsP+944v1I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4Td0Zm6phsz1vtV1; Sun, 18 Feb 2024 17:23:12 +0800 (CST) Received: from kwepemi500023.china.huawei.com (unknown [7.221.188.76]) by mail.maildlp.com (Postfix) with ESMTPS id C1D89140154; Sun, 18 Feb 2024 17:23:45 +0800 (CST) Received: from [10.110.54.32] (10.110.54.32) by kwepemi500023.china.huawei.com (7.221.188.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Sun, 18 Feb 2024 17:23:44 +0800 Subject: Re: [RESEND PATCH] llist: Make llist_del_first return only the first node To: "Huang, Ying" CC: , , , , References: <20240218065750.1241-1-liqiang64@huawei.com> <875xymtdy5.fsf@yhuang6-desk2.ccr.corp.intel.com> From: Li Qiang Message-ID: Date: Sun, 18 Feb 2024 17:23:44 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <875xymtdy5.fsf@yhuang6-desk2.ccr.corp.intel.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemi500023.china.huawei.com (7.221.188.76) 在 2024/2/18 15:43, Huang, Ying 写道: > liqiang writes: > >> Set the next of the returned node of llist_del_first >> to NULL, which can prevent subsequent nodes in llist >> from being exposed, and is more consistent with the >> logic of this interface. >> >> Signed-off-by: liqiang >> --- >> lib/llist.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/lib/llist.c b/lib/llist.c >> index f21d0cf..c33fff5 100644 >> --- a/lib/llist.c >> +++ b/lib/llist.c >> @@ -61,6 +61,7 @@ struct llist_node *llist_del_first(struct llist_head *head) >> next = READ_ONCE(entry->next); >> } while (!try_cmpxchg(&head->first, &entry, next)); >> >> + entry->next = NULL; >> return entry; >> } >> EXPORT_SYMBOL_GPL(llist_del_first); > > This isn't needed for functionality correctness. Many users of llist > ask for performance. So, it may be better to let the users to decide > whether to set entry->next to NULL. > Ok, get it, thanks for your reply. -- Best regards, Li Qiang