Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp791250imm; Fri, 31 Aug 2018 13:25:09 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYGSTWdxMKrv4sZDKNVZ84lESovAvIWxMAB6JsnD1rzxKNMjZs7prXcwBOLUCeF+FA0uFUf X-Received: by 2002:a63:fa49:: with SMTP id g9-v6mr16107792pgk.18.1535747108993; Fri, 31 Aug 2018 13:25:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535747108; cv=none; d=google.com; s=arc-20160816; b=TJiO0lV2aq2Wle3Lcs3QpryQUKqBZ4ZbSbWYvdTA5Fsj3R0yH7Lw186suNsffE92no K5WE/i83EytC8ISwFmfHZgL4bKQZXECnREwRnTnGjwKcDZe1z3gvPt4fqbU5tQxcsJsl phTry5XG1AIkCgFSuT83ygHzm537deggnSSVdfJkljKPdrQ0yl1FFv4WgYReOLe6gHDB lVnW12IYJBkgtVWv+0RKNmOu7yR5DjBg2L/WV+bZ/2+2VcVXoujTtD62f1cGPygQIiKK q0YAVAERKwpzuDJlVk7Rnms2rEd2AT0VuB1tZA7ZSoov8JOoKsDwjSVKM1qZwOL9TSSc r8sA== 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:arc-authentication-results; bh=mCSyTNKfNKsNWY9w2u1+8RMVPIGW7DHIDC+leU6W8m8=; b=BfP3IJJqQla1jN2EvPojqjidlTdcXuIbBhwU964oGj+LvaiiBh2x5dPrf5bE7hegyb 2hUbjwyqiEpjNXAv8rzYNLoUhYx0a1/2Y5NjqVjdMJM8SJeCfmDU4ThjgNCkj7Ip06mX o0ryPJIZVlnh6cDaqiR7/pbOSEq305d3Qu9R+QbnvRPyhyxYu7dxiF46rx1BbiZMh7d1 JzJmArSP0OhQ1ENkoZ3zNpQ4G8rmaaCXGZgXqmGnulA8Dlwif9QIVHGcKkbgH5nv6w5L jbIzmUUjVj07OyIz7PiuAkj9pmIFKBI3uvWS/5/U98P5F1P89pLdm1/7sK3/mNz+g5O4 TFKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TZZjRUqY; 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 d19-v6si10829934pgk.92.2018.08.31.13.24.54; Fri, 31 Aug 2018 13:25:08 -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=TZZjRUqY; 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 S1727650AbeIAAcV (ORCPT + 99 others); Fri, 31 Aug 2018 20:32:21 -0400 Received: from mail-yw1-f66.google.com ([209.85.161.66]:40339 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727334AbeIAAcV (ORCPT ); Fri, 31 Aug 2018 20:32:21 -0400 Received: by mail-yw1-f66.google.com with SMTP id z143-v6so5495415ywa.7; Fri, 31 Aug 2018 13:23:15 -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=mCSyTNKfNKsNWY9w2u1+8RMVPIGW7DHIDC+leU6W8m8=; b=TZZjRUqYnoro5nUsjPf4UN65TUPobFhe4ZygsrYrMZsdBT8kXARk8ydRzJl1CDvRlS o+1t6T8YeZmEIECE+Od52gLZvTiX89eIn7xwepHE5n3plMboWl3vXM+hj1ViKIG0crH9 TW8X6BgfTkiTWBXaJziBZiv+UxF1FYxS07PgHlynQG1heAYrfX1u7PZ2PevhvWlxsinh NSh9hm2HhRdZKfD66dEof/OzDNZtagZyvgCQ+vXDA3j+AGSWROafB1MOSoshXy1bA7P8 baEisqpwl+R5vtdE9zpy6j8X9dP8/+jFCaEfutFQmvUSajV+KIGDNgTzTRCnn/H0cReI mYYw== 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=mCSyTNKfNKsNWY9w2u1+8RMVPIGW7DHIDC+leU6W8m8=; b=NbeAfiFKP1ify9NRR4OaD0b8uVlcJlfwQ00r2pLdX20xXNXl0SyMY+f70ohf4jDCe9 u4GyAGd5HCoqeH9qOaMpmEidKNk/UNUL9OIAiQTJbEJpA7yH9CqTbizIWj9Nss1rwNxy pxDExu3mN5wsCV/SdYEHXAOIs2jL9PKBW6m47+tdFU4EJI4VjCakAYXuSSHS4sjN0wfE GDQ89c6UAE4s00EMhJ2oFQAqV7D/FXCfgBvvaPTilhDdGiMFqM7vJTnkcTqyQ2My/aVx n/yzEeuMsYkqLFDIdq/23dOd1730HbFrcTFfd3K796I8Wa/XaV5e+PMrAn0FSZjWF3wY WA8g== X-Gm-Message-State: APzg51CnjyKD63lyd1nmTKGuTF6YHMMy0bmA6Qp213Gx53OsPqLji1Gb S0k10iQtGB/979N7cv3Ztw4= X-Received: by 2002:a81:5c04:: with SMTP id q4-v6mr9668554ywb.465.1535746994936; Fri, 31 Aug 2018 13:23:14 -0700 (PDT) Received: from dennisz-mbp.thefacebook.com ([199.201.65.129]) by smtp.gmail.com with ESMTPSA id u8-v6sm3978961ywl.59.2018.08.31.13.23.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 31 Aug 2018 13:23:14 -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 0/3] fix blkcg offlining and destruction Date: Fri, 31 Aug 2018 16:22:41 -0400 Message-Id: <20180831202244.21678-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 split of an earlier series I sent out [1] containing the first 3 patches with fixes from feedback. This series tackles the first problem where blkcgs were not being destroyed. There is a regression in blkcg destruction where references weren't properly put causing blkcgs to never be destroyed. Previously, blkgs were destroyed during offlining of the blkcg. This puts back the blkcg reference a blkg holds allowing blkcg ref to reach zero. Then, blkcg_css_free() is called as part of the final cleanup. To address the problem, 0001 reverts the broken commit, 0002 delays blkg destruction until writeback has finished, and 0003 closes the window on a race condition between a css migration and dying, and blkg association. This should fix the issue where blkg_get() was getting called when a blkcg had already begun exiting. If a bio finds itself here, it will just fall back to root. Oddly enough at one point, blk-throttle was using policy data from and associating with potentially different blkgs, thus how this was exposed. [1] https://lore.kernel.org/lkml/20180831015356.69796-1-dennisszhou@gmail.com/T This patchset contains the following 3 patches: 0001-Revert-blk-throttle-fix-race-between-blkcg_bio_issue.patch 0002-blkcg-delay-blkg-destruction-until-after-writeback-h.patch 0003-blkcg-use-tryget-logic-when-associating-a-blkg-with-.patch 0001 reverts the broken commit. 0002 delays blkg destruction until after writeback. 0003 fixes a race condition for ongoing IO and blkcg destruction. This patchset is on top of axboe#for-4.19/block b86d865cb1ca. diffstats below: Dennis Zhou (Facebook) (3): Revert "blk-throttle: fix race between blkcg_bio_issue_check() and cgroup_rmdir()" blkcg: delay blkg destruction until after writeback has finished blkcg: use tryget logic when associating a blkg with a bio block/bio.c | 3 +- block/blk-cgroup.c | 105 +++++++++++++++++-------------------- block/blk-throttle.c | 5 +- include/linux/blk-cgroup.h | 45 +++++++++++++++- mm/backing-dev.c | 5 ++ 5 files changed, 102 insertions(+), 61 deletions(-) Thanks, Dennis