Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1054027imm; Thu, 6 Sep 2018 14:38:40 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdbiw1WvVaP2OJeYei3rINx/flw1GU7iR7ZagREqy8673j9Czte/DIRiltVknUGyVN9o8yyK X-Received: by 2002:a17:902:5a4e:: with SMTP id f14-v6mr4851178plm.311.1536269920077; Thu, 06 Sep 2018 14:38:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536269920; cv=none; d=google.com; s=arc-20160816; b=ZCf2qe0EqMudnkPQQFH/0UIhhQljviREQqa40w+m7O6ER4HmhpMUyxZyKMbfCfyb1d 8wTRHKRl7iJyqNPw8ge4ReLClDSuet9tbLqxGm64NPP9SmJCbGscl4iBRLmSo0j5lhaB ZY1zx5YaNRXkMcgKv91WFb2yrm19mESO5vJSX+xBWFP/rHvqWqwyKM6XACf5WoAesFeI tLKsN99CeEk1fAULCwPZhfYYLzmOZS60ZvfQoR7rgSEKW8kaYL6q9lsd01IFldV9pA5k LH2Dde5pvuKp1eP09OW6t1+71ZUREZeEZ7sqeYGQeDt4wXZ/nnJaXEIwXJ6WtJOsnVNS t6mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=CxZOb6PLVyhKJ0NyoVh/rmba5v2FOrA4jy/PeKrQmVU=; b=CmWVuTbiiuTVbkUoZHrjdv6RXEiowSDAyK0ZJqxtms3Nk/TAJ4aaYF1lnz3ku6Th24 Ogp6L28Mw2dtlE48pgQ3ZtrKgmb4Fxow0pOtOt6tCU6j2eFafPqA32YyI878FubXlCyS dmaqCgtvcDnAXJA3tuKjRcBsOwesX84x7UgnOT8jX1aw3QRdmIzdz0kc5HKx0JEg/9kk aaix4es6sXwRKdFUj/GposxolnKXPb6vTTOYNHCM+trzbljTijxgb74kXoI8rL6mtUNz Zv4pQbg90KeY/sXJY+Ymtez46xi2X3YGfLvR5m7RFLlBjzc6z4bKF1NNr/pOXNwFk55A 9juw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PMAfn8PK; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i21-v6si6231101pgb.81.2018.09.06.14.38.23; Thu, 06 Sep 2018 14:38:40 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PMAfn8PK; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728055AbeIGBsO (ORCPT + 99 others); Thu, 6 Sep 2018 21:48:14 -0400 Received: from mail-yw1-f68.google.com ([209.85.161.68]:35325 "EHLO mail-yw1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727657AbeIGBsO (ORCPT ); Thu, 6 Sep 2018 21:48:14 -0400 Received: by mail-yw1-f68.google.com with SMTP id 14-v6so4645767ywe.2; Thu, 06 Sep 2018 14:10:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=CxZOb6PLVyhKJ0NyoVh/rmba5v2FOrA4jy/PeKrQmVU=; b=PMAfn8PKSyjmkhupwy6gvyXjIUw/ADlttACBgrlrRIWf5ZqZGoudw3bLYfmLS+/k4d LzuBd1K6MCR5Xu6acHb7BkPXpskr63OYYIphueqoEdHlpvG9GyS4iZS9kkAOT9RjkiSN 36/gRT2W9p6yHJCqzW5evoahJ8KmTkYTgV9RdF1CIEC/bxV6I+SB2VEN6Ol3vp/cXMgW 3WyTjjV8o4MUCcokWKLvyxdYf8Gw7NU7cO/KyTqqBYRig7AIe/lwuhJd+wVIp+2lfd89 Px8eETTDCbMF0KeUFaOgwEPd8hP0N8EMPAe/HmtLXfUn6Qnm8XrtTc2sI5gK79Adp07Z 3tGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=CxZOb6PLVyhKJ0NyoVh/rmba5v2FOrA4jy/PeKrQmVU=; b=D9PuAwzUiWDcsHDTtp2Q+YteeozMYE6xEfLHHurbmyWijL0GqfeR5LJhCuASyvz7tq ua39fSeE+Tp96GfiFjnVuLupUmxpqlpuatIHDAURMlN+nSerffvDKPWsa0PImd2agspn MjAMPkO+/Eqs1/Eyq00MTf7rPqSWb0rrN9ZFRPT4Upjtczl2nRz5Mk1C7ukV6YULXnUZ K1KUfb+7K5QkKFXBxFHeKrUu7vEusLvy6KEjdDJWytl3NaHgmCQdy6OiOgXho3KA4htz L/xd0qwbY010yL2rsr1gtmll/NvOpm+Lj0TiRUOb/o4KA/edcC8y2s/mCl4Eblc652qQ DaZg== X-Gm-Message-State: APzg51CQJDOnbcCvxPmUCUKTJex4EfdpuDLAGEpDcN86uh9MBBlS3uU9 eqci5B8OSYBSL+KHf7gNK6E= X-Received: by 2002:a0d:f387:: with SMTP id c129-v6mr2536527ywf.283.1536268256868; Thu, 06 Sep 2018 14:10:56 -0700 (PDT) Received: from dennisz-mbp.thefacebook.com ([199.201.65.129]) by smtp.gmail.com with ESMTPSA id u67-v6sm2032802ywa.56.2018.09.06.14.10.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Sep 2018 14:10:55 -0700 (PDT) From: Dennis Zhou To: Jens Axboe , Tejun Heo , Johannes Weiner , Josef Bacik Cc: kernel-team@fb.com, linux-block@vger.kernel.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Dennis Zhou Subject: [PATCH 00/12] block: always associate blkg and refcount cleanup Date: Thu, 6 Sep 2018 17:10:33 -0400 Message-Id: <20180906211045.29055-1-dennisszhou@gmail.com> X-Mailer: git-send-email 2.13.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi everyone, 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-next 9c8f7b6493d9, a merge commit from merging back axboe#for-linus. 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 | 153 ++++++++++++++++-------- block/blk-cgroup.c | 120 +++++++++++++------ 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 | 147 ++++++++++++++++------- include/linux/blk_types.h | 1 - include/linux/cgroup.h | 2 + include/linux/writeback.h | 5 +- kernel/cgroup/cgroup.c | 53 ++++++-- kernel/trace/blktrace.c | 4 +- mm/page_io.c | 2 +- 21 files changed, 380 insertions(+), 210 deletions(-) Thanks, Dennis