Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp328497pxj; Thu, 10 Jun 2021 01:34:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5xK3nqPgd5rLa8v9B5O58ZUH1oGHbwcqotCEZwGdcIbA4riPvfUM4hMwwuKLJ+vnajAqc X-Received: by 2002:a17:907:789a:: with SMTP id ku26mr3303319ejc.411.1623314040626; Thu, 10 Jun 2021 01:34:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623314040; cv=none; d=google.com; s=arc-20160816; b=fA/Bh6ztczU6HBSxyqm6gv8tTmjsh4UKm20eYOzs4OScANgqKzf+9tor+dDbtHi7ES I8vgRZNLLrGWpupNIgJpBzhzDByQRhy6AsnHamvlgGgFNpvlgjPmGwIpDB8CUoqz5ujt TDT/RwSoqRaWog8elWt4U7JmBoqsuyrpKV0doANm/3ypNFLMSbPFB68trJ7ngby/VpTi 0we/SB/Fx5Thcp4ftusTm0/KvVe8HqkyFNtY32k7bWfP9gLOs+rZuvPcR+wWRvggo/1R Sm7u8v06ZVvIht4MXxLVUgBUjQdgntVmI2hSB4LDVOnZlnrna0mkdyZ7ULqaaY6+ZejE vxnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=jn+AugA0jjeMf75IXMzBMJDsoobmw9Ii5lTQIUixXj4=; b=l7uXWNzP+uLqSxk++0qAC6eUq7HAERDZhvSKXZeWhXWTcamikytLfxeCfgaHf9r1yc 7j9n+M1G1ctAgcL9AFurYhXH88U7DnNxMxTT+/cHrPi4cBsDP1zHRXxrQpH7Kmke0ROK UjqwQi2obl/+bWUQwYFaK9Nb3+dMhp+bFaCkpH3v9rRWZXzd23t0PsFIOceMDA+jE3QL xGbL9ewfG7G+LolrNQEbvC9Nx+V36HML7xnBz7Tc8OrGn2fqYLJXB6d6G6nX2PtFwehL 2eiLTqlQz0JcM53fIUHGcYr01vWA5iJyCyuzBuOCFEk2e90kAbmSN+a1m4tOMhaXAbDE ca2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@natalenko.name header.s=dkim-20170712 header.b=Q65hq5fF; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=natalenko.name Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b4si1814978edr.197.2021.06.10.01.33.37; Thu, 10 Jun 2021 01:34:00 -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=@natalenko.name header.s=dkim-20170712 header.b=Q65hq5fF; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=natalenko.name Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229770AbhFJIdy (ORCPT + 99 others); Thu, 10 Jun 2021 04:33:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230186AbhFJIdt (ORCPT ); Thu, 10 Jun 2021 04:33:49 -0400 Received: from vulcan.natalenko.name (vulcan.natalenko.name [IPv6:2001:19f0:6c00:8846:5400:ff:fe0c:dfa0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5678C0617A6 for ; Thu, 10 Jun 2021 01:31:51 -0700 (PDT) Received: from localhost (unknown [151.237.229.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by vulcan.natalenko.name (Postfix) with ESMTPSA id 9AB93AC8E83; Thu, 10 Jun 2021 10:31:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=natalenko.name; s=dkim-20170712; t=1623313908; 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: in-reply-to:in-reply-to:references:references; bh=jn+AugA0jjeMf75IXMzBMJDsoobmw9Ii5lTQIUixXj4=; b=Q65hq5fFQmFLGz6fM4S+YX8dskwWz+s7YJOd1oD5HrNpwJh/9osLB6RLffrQQXbtNO4bxr tYAk0GX6jZQREnlchpLJfETwaD6I4Az5KX7IYCNwk5yBzWh2QWdzsIenBwrNa1CLtDKlvv gFXgStH0IAv4fOolr4VlKgFVTiI4UcM= Date: Thu, 10 Jun 2021 10:31:47 +0200 From: Oleksandr Natalenko To: brookxu Cc: paolo.valente@linaro.org, axboe@kernel.dk, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Piotr Gorski Subject: Re: [RESEND PATCH 1/8] bfq: introduce bfq_entity_to_bfqg helper method Message-ID: <20210610083147.xoefokucl5ey7v32@spock.localdomain> References: <20210610072230.TAxxdh-wsL4sihK2TJxF-Gz85ZgsFR7IwOuifnxFi0k@z> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210610072230.TAxxdh-wsL4sihK2TJxF-Gz85ZgsFR7IwOuifnxFi0k@z> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello. On Thu, Jun 10, 2021 at 03:22:30PM +0800, brookxu wrote: > From: Chunguang Xu > > Introduce bfq_entity_to_bfqg() to make it easier to obtain the > bfq_group corresponding to the entity. > > Signed-off-by: Chunguang Xu > --- > block/bfq-cgroup.c | 6 ++---- > block/bfq-iosched.h | 1 + > block/bfq-wf2q.c | 16 ++++++++++++---- > 3 files changed, 15 insertions(+), 8 deletions(-) > > diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c > index b791e20..a5f544a 100644 > --- a/block/bfq-cgroup.c > +++ b/block/bfq-cgroup.c > @@ -309,8 +309,7 @@ struct bfq_group *bfqq_group(struct bfq_queue *bfqq) > { > struct bfq_entity *group_entity = bfqq->entity.parent; > > - return group_entity ? container_of(group_entity, struct bfq_group, > - entity) : > + return group_entity ? bfq_entity_to_bfqg(group_entity) : > bfqq->bfqd->root_group; > } > > @@ -610,8 +609,7 @@ struct bfq_group *bfq_find_set_group(struct bfq_data *bfqd, > */ > entity = &bfqg->entity; > for_each_entity(entity) { > - struct bfq_group *curr_bfqg = container_of(entity, > - struct bfq_group, entity); > + struct bfq_group *curr_bfqg = bfq_entity_to_bfqg(entity); > if (curr_bfqg != bfqd->root_group) { > parent = bfqg_parent(curr_bfqg); > if (!parent) > diff --git a/block/bfq-iosched.h b/block/bfq-iosched.h > index b8e793c..a6f98e9 100644 > --- a/block/bfq-iosched.h > +++ b/block/bfq-iosched.h > @@ -941,6 +941,7 @@ struct bfq_group { > #endif > > struct bfq_queue *bfq_entity_to_bfqq(struct bfq_entity *entity); > +struct bfq_group *bfq_entity_to_bfqg(struct bfq_entity *entity); > > /* --------------- main algorithm interface ----------------- */ > > diff --git a/block/bfq-wf2q.c b/block/bfq-wf2q.c > index 070e34a..5ff0028 100644 > --- a/block/bfq-wf2q.c > +++ b/block/bfq-wf2q.c > @@ -149,7 +149,7 @@ struct bfq_group *bfq_bfqq_to_bfqg(struct bfq_queue *bfqq) > if (!group_entity) > group_entity = &bfqq->bfqd->root_group->entity; > > - return container_of(group_entity, struct bfq_group, entity); > + return bfq_entity_to_bfqg(group_entity); > } > > /* > @@ -208,7 +208,7 @@ static bool bfq_no_longer_next_in_service(struct bfq_entity *entity) > if (bfq_entity_to_bfqq(entity)) > return true; > > - bfqg = container_of(entity, struct bfq_group, entity); > + bfqg = bfq_entity_to_bfqg(entity); > > /* > * The field active_entities does not always contain the > @@ -266,6 +266,15 @@ struct bfq_queue *bfq_entity_to_bfqq(struct bfq_entity *entity) > return bfqq; > } > > +struct bfq_group *bfq_entity_to_bfqg(struct bfq_entity *entity) > +{ > + struct bfq_group *bfqg = NULL; > + > + if (entity->my_sched_data) > + bfqg = container_of(entity, struct bfq_group, entity); > + > + return bfqg; > +} > > /** > * bfq_delta - map service into the virtual time domain. > @@ -1001,8 +1010,7 @@ static void __bfq_activate_entity(struct bfq_entity *entity, > > #ifdef CONFIG_BFQ_GROUP_IOSCHED > if (!bfq_entity_to_bfqq(entity)) { /* bfq_group */ > - struct bfq_group *bfqg = > - container_of(entity, struct bfq_group, entity); > + struct bfq_group *bfqg = bfq_entity_to_bfqg(entity); > struct bfq_data *bfqd = bfqg->bfqd; > > if (!entity->in_groups_with_pending_reqs) { > -- > 1.8.3.1 > If it is a resend only, I can offer my Tested-by since I'm running this series for quite some time already. Thanks. -- Oleksandr Natalenko (post-factum)