From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6868FC43334 for ; Wed, 1 Jun 2022 21:31:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231609AbiFAVbf (ORCPT ); Wed, 1 Jun 2022 17:31:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231587AbiFAVbS (ORCPT ); Wed, 1 Jun 2022 17:31:18 -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 ESMTP id 66B6D9E9EF for ; Wed, 1 Jun 2022 14:31:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654119059; 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=5Q5Yw9t0Y+2Q0d6nFtht5jV9c3xFTEYinX8tRSP5cPo=; b=P6XJs56r3qGAOi0GTHaVC0ZvofqfH2M5sqxGuFkLj7/dFHv6b6eFiVC4adNngY3kE6ZiUL AMHDsiTQvifU9BdhzIww4A/M9othrANxKHK7+vOzLtV2lMWOdxJ0cCWv08LI55Y9YT/bdm 7/hwlLuUMItRubHZQeSfjZyelrSrcIY= 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-640-r4dROy8VPu6p05x1WXSfgA-1; Wed, 01 Jun 2022 17:30:54 -0400 X-MC-Unique: r4dROy8VPu6p05x1WXSfgA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 030A3811E7A; Wed, 1 Jun 2022 21:30:54 +0000 (UTC) Received: from [10.18.17.215] (dhcp-17-215.bos.redhat.com [10.18.17.215]) by smtp.corp.redhat.com (Postfix) with ESMTP id B890840885A1; Wed, 1 Jun 2022 21:30:53 +0000 (UTC) Message-ID: <9b1c20a7-ef93-d6c9-9054-64688cf48625@redhat.com> Date: Wed, 1 Jun 2022 17:30:53 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH v3 2/2] blk-cgroup: Optimize blkcg_rstat_flush() Content-Language: en-US To: Tejun Heo Cc: Jens Axboe , cgroups@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Ming Lei References: <20220601211824.89626-1-longman@redhat.com> <20220601211824.89626-3-longman@redhat.com> From: Waiman Long In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/1/22 17:26, Tejun Heo wrote: > On Wed, Jun 01, 2022 at 05:18:24PM -0400, Waiman Long wrote: >> @@ -59,6 +59,57 @@ static struct workqueue_struct *blkcg_punt_bio_wq; >> >> #define BLKG_DESTROY_BATCH_SIZE 64 >> >> +/* >> + * lnode.next of the last entry in a lockless list is NULL. To make it >> + * always non-NULL for lnode's, a sentinel node has to be put at the >> + * end of the lockless list. So all the percpu lhead's are initialized >> + * to point to that sentinel node. >> + */ > Can you please add why we want all entries to have non-NULL next? As said elsewhere, lnode->next is used as a flag to indicate its presence in a lockless list. Sorry for not being explicit here. > >> +static inline bool blkcg_llist_empty(struct llist_head *lhead) >> +{ >> + return lhead->first == &llist_last; >> +} >> + >> +static inline void init_blkcg_llists(struct blkcg *blkcg) >> +{ >> + int cpu; >> + >> + for_each_possible_cpu(cpu) >> + per_cpu_ptr(blkcg->lhead, cpu)->first = &llist_last; >> +} >> + >> +static inline struct llist_node * >> +fetch_delete_blkcg_llist(struct llist_head *lhead) >> +{ >> + return xchg(&lhead->first, &llist_last); >> +} >> + >> +static inline struct llist_node * >> +fetch_delete_lnode_next(struct llist_node *lnode) >> +{ >> + struct llist_node *next = READ_ONCE(lnode->next); >> + struct blkcg_gq *blkg = llist_entry(lnode, struct blkg_iostat_set, >> + lnode)->blkg; >> + >> + WRITE_ONCE(lnode->next, NULL); >> + percpu_ref_put(&blkg->refcnt); >> + return next; >> +} > It's not a strong opinion but I'm not too fond of using inlines to mark > trivial functions. The compiler should be able to make these decisions, > right? > > Other than the above two bikesheddings, Sure, I can remove the inline keywords. I think I do it out of habit:-) Regards, Longman > > Acked-by: Tejun Heo > > Thanks. >