From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753732AbdLVN5g (ORCPT ); Fri, 22 Dec 2017 08:57:36 -0500 Received: from mga07.intel.com ([134.134.136.100]:2349 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751770AbdLVN5f (ORCPT ); Fri, 22 Dec 2017 08:57:35 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,441,1508828400"; d="scan'208";a="13888552" From: "Huang\, Ying" To: Vitaly Wool Cc: LKML , Subject: Re: [PATCH/RFC] llist: add llist_[add|del_first]_exclusive References: <20171218154651.777fb889c34259799bef3024@gmail.com> <87h8snv6sh.fsf@yhuang-dev.intel.com> <87bmiutdwf.fsf@yhuang-dev.intel.com> Date: Fri, 22 Dec 2017 21:57:32 +0800 In-Reply-To: (Vitaly Wool's message of "Fri, 22 Dec 2017 11:34:34 +0100") Message-ID: <87vagyj25v.fsf@yhuang-dev.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Vitaly Wool writes: > 2017-12-20 1:57 GMT+01:00 Huang, Ying : > > > >> >> > Could you please elaborate how this would be implemented "on top"? >> >> struct llist_node *my_del_first_exclusive(struct llist_head *head) >> { >> struct llist_node *node = llist_del_first(head); >> >> if (node) >> node->next = LLIST_NODE_UNLISTED; >> } >> >> bool my_add_exclusive(struct llist_node *node, struct llist_head *head) >> { >> if (node->next != LLIST_NODE_UNLIST) >> return false; >> if (cmpxchg(&node->next, LLIST_NODE_UNLIST, NULL) != >> LLIST_NODE_UNLIST) >> return false; >> llist_add(node, head); >> return true; >> } >> > > That would work, thanks. I'll update the patch. Is there any other users except your code? If no, I think it's better to keep it with its only user instead part of llist library at least for now. Because I don't know whether the usage model is popular. Best Regards, Huang, Ying > Thanks, > Vitaly