Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2891070imu; Thu, 29 Nov 2018 11:55:08 -0800 (PST) X-Google-Smtp-Source: AFSGD/ViLdNYKki5KQVZyyVi4PpbPoAHtfV7CR/j7JlxpDyQc/aGLn/EijXHbDdOI6Z3R9jX5vGq X-Received: by 2002:a65:6094:: with SMTP id t20mr2328693pgu.285.1543521308844; Thu, 29 Nov 2018 11:55:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543521308; cv=none; d=google.com; s=arc-20160816; b=Ckqhrjrb8SUbwUtbYpKdD0UoSCqaY6maOr6lbijziXN48WdDPm9GWVyjzfu6Ag7cz4 Drg1W21H7J+Qi3EIXsXFgi6mww+fdX9Izr8rAhcuiup1g78Qi6rioXAQB6RkxCxyq90l D0RUFZ/5467GTUe5J990jE9v6r+Iv5s6EswrV8Z8bvny4FdHeA8AWx2GWlHq3xSCu6w4 Ny2onV16gDUIlW7VJWfpAN7RvDj0wjTBBKxaowHt5N0ILrzLRYQkNgxTVKgpm0lYTOn9 r9kXY+VBU9om5/yivInbkeRNBl+M+QKvIWMq/qrOUcu2O5pcndP0/zH2HI/gd1PykMKz k84w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=NJ5okLZf6zf5iLP8VBExp3x933pXCM86os+NEW1YCCs=; b=xqPBDZbxnW6RkCB90pHRSSnLxMkD1OFoLVQjt/JnWC3t+vFhTdWjpVlofFazulxeGC le6omu8Fpx5PB18PT6HEu76kk4jewoLTSD0pU+kO2mYdkWwf+gCF2ygR+DEJlKJtPm1w rwS9BhT0sYYA3Pl1ZZN+5oKhX7QmDRjja8MT2pUf4WXZKNF2K87LK+4dkydiQZKyMRwK ZZwVDBrEJabI4IgETGVrQW3cHAXM+a9eq5lfJbS1tnF4Yb/07cO17SoszFmshdxUeezr V3dZTaA1q6tV85YzLFiosT37GXDzQleM3A8mXEV7YyOrV2tqHnXcrz8F7eAFCdjRq0eT crGg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l24si2628427pgj.171.2018.11.29.11.54.54; Thu, 29 Nov 2018 11:55:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726528AbeK3HAp (ORCPT + 99 others); Fri, 30 Nov 2018 02:00:45 -0500 Received: from mail-yw1-f65.google.com ([209.85.161.65]:44386 "EHLO mail-yw1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725788AbeK3HAp (ORCPT ); Fri, 30 Nov 2018 02:00:45 -0500 Received: by mail-yw1-f65.google.com with SMTP id i22so973024ywa.11; Thu, 29 Nov 2018 11:54:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=NJ5okLZf6zf5iLP8VBExp3x933pXCM86os+NEW1YCCs=; b=X2a3aOYSot0rj75VGUd6zOKLsRlazknYvolDgvmMcmwRTDEboxwHEoD+NB5QhJbKbC 9M4mv8mHvbTyVTSCXp5luIukDPGJwFpoOJeKZwYp76+10E4TGFAXyapuy+HJg1Za2lmB yUBzSgELFAv82ETOInR6lpvBDL2t5eU67kJF7LopjsGkomTxkHpG6cgQm1ZVnNPeXFb0 EDbk8abku+rK/joEaBSl9xCHy4ia7oDh7SxPejyZhAq7hr+a3FOVNioe50NHs2aGtZMG WveEu1YiM/N9bf02u9ftMT65aCbbTnVlrzWptiMWykYEa3ByF2N2b3T6cKXiRdE6Sxvw eoLQ== X-Gm-Message-State: AA+aEWbo3YZoUcY3c5F19DA+krbGRHCRqth4Lky7bK/deOEpvbPs9937 uM37xhXyLj+iSkIcEb8DxNU= X-Received: by 2002:a81:7102:: with SMTP id m2mr2789225ywc.235.1543521250770; Thu, 29 Nov 2018 11:54:10 -0800 (PST) Received: from dennisz-mbp.dhcp.thefacebook.com ([2620:10d:c091:200::7:3dcb]) by smtp.gmail.com with ESMTPSA id m66sm682997ywc.37.2018.11.29.11.54.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Nov 2018 11:54:10 -0800 (PST) Date: Thu, 29 Nov 2018 14:54:07 -0500 From: Dennis Zhou To: Tejun Heo Cc: Jens Axboe , Johannes Weiner , Josef Bacik , kernel-team@fb.com, linux-block@vger.kernel.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 05/13] blkcg: associate blkg when associating a device Message-ID: <20181129195407.GB95415@dennisz-mbp.dhcp.thefacebook.com> References: <20181126211946.77067-1-dennis@kernel.org> <20181126211946.77067-6-dennis@kernel.org> <20181129155333.GE2509588@devbig004.ftw2.facebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181129155333.GE2509588@devbig004.ftw2.facebook.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 29, 2018 at 07:53:33AM -0800, Tejun Heo wrote: > On Mon, Nov 26, 2018 at 04:19:38PM -0500, Dennis Zhou wrote: > > diff --git a/include/linux/bio.h b/include/linux/bio.h > > index 62715a5a4f32..8bc9d9b29fd3 100644 > > --- a/include/linux/bio.h > > +++ b/include/linux/bio.h > > @@ -486,6 +486,12 @@ extern unsigned int bvec_nr_vecs(unsigned short idx); > > extern const char *bio_devname(struct bio *bio, char *buffer); > > > > #define bio_set_dev(bio, bdev) \ > > +do { \ > > + bio_set_dev_only(bio, bdev); \ > > + bio_associate_blkg(bio); \ > > +} while (0) > > + > > +#define bio_set_dev_only(bio, bdev) \ > > do { \ > > if ((bio)->bi_disk != (bdev)->bd_disk) \ > > bio_clear_flag(bio, BIO_THROTTLED);\ > > Generally looks okay to me but I'm not sure about bio_set_dev_only(). > Maybe sth more explicit like bio_set_dev_without_blkg()? Also, can > you please add comments explaining which should be used when? > I've switched it to bio_set_dev_without_blkg() and added the comment below and added a comment in the use cases. Let me know if the wording is fine below. +/* + * Bio device setters. A blkg represents the relationship between a blkcg + * and a request_queue. When the device is set for a bio, it becomes possible + * to do blkg association. Importantly, a blkg also holds a pointer back to + * the request_queue. In general, bio_set_dev() should be used to keep + * bio->bi_disk->queue and bio->bi_blkg->q consistent. If blkg association + * will be done explicitly or is a bio based device, use + * bio_set_dev_without_blkg(). + */ Thanks, Dennis