LKML Archive on lore.kernel.org
 help / color / Atom feed
From: Dennis Zhou <dennisszhou@gmail.com>
To: Jens Axboe <axboe@kernel.dk>, Tejun Heo <tj@kernel.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Josef Bacik <josef@toxicpanda.com>
Cc: kernel-team@fb.com, linux-block@vger.kernel.org,
	cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
	Dennis Zhou <dennisszhou@gmail.com>
Subject: [PATCH v3 00/12] block: always associate blkg and refcount cleanup
Date: Tue, 11 Sep 2018 14:41:25 -0400
Message-ID: <20180911184137.35897-1-dennisszhou@gmail.com> (raw)

Hi everyone,

v3: a few minor fixes.
  0003: Updated the comment to bio_associate_blkg to reflect closest
        association.
        Removed a return branch in __bio_lookup_create.
  0009: Removed an unnecessary rcu_read_(un)lock pair.
  0010: Fixed blkg null pointer... blkg->blkcg => blkcg.

This is rebased onto axboe#for-4.20/block 902d53914f64.

From v2 below (updated):
------
This is a followup to the patch series I sent out earlier [1] containing
the middle two points:
  1. always associate a bio with a blkg
  2. remove the extra css ref held by bios and utilize the blkg ref

The major difference with v2 is that error handling on blkg creation
and association failure is handled more gracefully. Rather than having
the complex logic to fallback to root, failures walk up the blkg tree.
This seems more natural and less prone to error with the many possible
failure scenarios.

Additionally, there are fixes for kbuild errors and some key details
overlooked by me in the first series that were pointed out in review.

Modified from the first patchset:
First, both blk-throttle and blk-iolatency rely on blkg association
to enable their policies. Rather than each policy (and future policies)
implement this logic independently, this consolidates it such that
all bios are tagged with a blkg.

Second, with the addition of always having a blkg reference, the blkcg
can now be referenced through it rather than maintaining an additional
pointer and reference. So let's clean this up.

[1] https://lore.kernel.org/lkml/20180831015356.69796-1-dennisszhou@gmail.com/T

This patchset contains the following 12 patches:
  0001-blkcg-fix-ref-count-issue-with-bio_blkcg-using-task_.patch
  0002-blkcg-update-blkg_lookup_create-to-do-locking.patch
  0003-blkcg-convert-blkg_lookup_create-to-find-closest-blk.patch
  0004-blkcg-always-associate-a-bio-with-a-blkg.patch
  0005-blkcg-consolidate-bio_issue_init-to-be-a-part-of-cor.patch
  0006-blkcg-associate-a-blkg-for-pages-being-evicted-by-sw.patch
  0007-blkcg-associate-writeback-bios-with-a-blkg.patch
  0008-blkcg-remove-bio-bi_css-and-instead-use-bio-bi_blkg.patch
  0009-blkcg-remove-additional-reference-to-the-css.patch
  0010-blkcg-cleanup-and-make-blk_get_rl-use-blkg_lookup_cr.patch
  0011-blkcg-change-blkg-reference-counting-to-use-percpu_r.patch
  0012-blkcg-rename-blkg_try_get-to-blkg_tryget.patch

This patchset is on top of axboe#for-4.20/block 902d53914f64.

diffstats below:

Dennis Zhou (Facebook) (12):
  blkcg: fix ref count issue with bio_blkcg using task_css
  blkcg: update blkg_lookup_create to do locking
  blkcg: convert blkg_lookup_create to find closest blkg
  blkcg: always associate a bio with a blkg
  blkcg: consolidate bio_issue_init to be a part of core
  blkcg: associate a blkg for pages being evicted by swap
  blkcg: associate writeback bios with a blkg
  blkcg: remove bio->bi_css and instead use bio->bi_blkg
  blkcg: remove additional reference to the css
  blkcg: cleanup and make blk_get_rl use blkg_lookup_create
  blkcg: change blkg reference counting to use percpu_ref
  blkcg: rename blkg_try_get to blkg_tryget

 Documentation/admin-guide/cgroup-v2.rst |   8 +-
 block/bfq-cgroup.c                      |   4 +-
 block/bfq-iosched.c                     |   2 +-
 block/bio.c                             | 158 ++++++++++++++++--------
 block/blk-cgroup.c                      | 123 ++++++++++++------
 block/blk-iolatency.c                   |  26 +---
 block/blk-throttle.c                    |  13 +-
 block/bounce.c                          |   4 +-
 block/cfq-iosched.c                     |   4 +-
 drivers/block/loop.c                    |   5 +-
 drivers/md/raid0.c                      |   2 +-
 fs/buffer.c                             |  10 +-
 fs/ext4/page-io.c                       |   2 +-
 include/linux/bio.h                     |  23 ++--
 include/linux/blk-cgroup.h              | 145 +++++++++++++++-------
 include/linux/blk_types.h               |   1 -
 include/linux/cgroup.h                  |   2 +
 include/linux/writeback.h               |   5 +-
 kernel/cgroup/cgroup.c                  |  48 +++++--
 kernel/trace/blktrace.c                 |   4 +-
 mm/page_io.c                            |   2 +-
 21 files changed, 381 insertions(+), 210 deletions(-)

Thanks,
Dennis

             reply index

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-11 18:41 Dennis Zhou [this message]
2018-09-11 18:41 ` [PATCH 01/12] blkcg: fix ref count issue with bio_blkcg using task_css Dennis Zhou
2018-09-11 18:41 ` [PATCH 02/12] blkcg: update blkg_lookup_create to do locking Dennis Zhou
2018-09-11 18:41 ` [PATCH 03/12] blkcg: convert blkg_lookup_create to find closest blkg Dennis Zhou
2018-09-11 23:50   ` Tejun Heo
2018-09-11 18:41 ` [PATCH 04/12] blkcg: always associate a bio with a blkg Dennis Zhou
2018-09-11 18:41 ` [PATCH 05/12] blkcg: consolidate bio_issue_init to be a part of core Dennis Zhou
2018-09-11 18:41 ` [PATCH 06/12] blkcg: associate a blkg for pages being evicted by swap Dennis Zhou
2018-09-11 18:41 ` [PATCH 07/12] blkcg: associate writeback bios with a blkg Dennis Zhou
2018-09-11 18:41 ` [PATCH 08/12] blkcg: remove bio->bi_css and instead use bio->bi_blkg Dennis Zhou
2018-09-11 18:41 ` [PATCH 09/12] blkcg: remove additional reference to the css Dennis Zhou
2018-09-11 23:51   ` Tejun Heo
2018-09-11 18:41 ` [PATCH 10/12] blkcg: cleanup and make blk_get_rl use blkg_lookup_create Dennis Zhou
2018-09-11 18:41 ` [PATCH 11/12] blkcg: change blkg reference counting to use percpu_ref Dennis Zhou
2018-09-11 18:41 ` [PATCH 12/12] blkcg: rename blkg_try_get to blkg_tryget Dennis Zhou
2018-09-21 20:56 ` [PATCH v3 00/12] block: always associate blkg and refcount cleanup Dennis Zhou
2018-09-22  2:29   ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180911184137.35897-1-dennisszhou@gmail.com \
    --to=dennisszhou@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@fb.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
	git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git