From patchwork Wed Sep 23 21:07:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejun Heo X-Patchwork-Id: 7252561 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 866179F32B for ; Wed, 23 Sep 2015 21:07:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 85BA720916 for ; Wed, 23 Sep 2015 21:07:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 92C6120907 for ; Wed, 23 Sep 2015 21:07:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755537AbbIWVHf (ORCPT ); Wed, 23 Sep 2015 17:07:35 -0400 Received: from mail-yk0-f174.google.com ([209.85.160.174]:35876 "EHLO mail-yk0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755128AbbIWVHe (ORCPT ); Wed, 23 Sep 2015 17:07:34 -0400 Received: by ykdt18 with SMTP id t18so54830948ykd.3; Wed, 23 Sep 2015 14:07:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=7JfP6Z+qXMEoeCYlrOcl3ZPAK9djNFHqsDdc8pnh2LI=; b=T+M67p3TIRfk7Vaztlmnw4T0xEMydEL3oEximJfq1O0GiGI8ygx3G7J3ZnNvG58qW+ FuMwcjUj39NTVa76G9KZ2XsUpAj7xVE3bGglpidjo+vKAxRi/TRQkryyR92bmNAHFg87 JK8jJkqbfXSyK80jPrJ02H4iB6SrBAu9tzsFfE4vOrq583S45uWLUj6EcgCaT2G652PH PjjFffa5J4p7GHvwXkX2JeLujYvIlykFjquCwbc/AiPQERVMHNjxXKgj1QFJikE4lVZ3 0RqbdYEjUO1KZbdCRCdiHI0nMnwJMyVVHNWt+XcQTF48WCc/ZF5H3cbbto0mLxzwZ72o Nz8A== X-Received: by 10.13.217.5 with SMTP id b5mr28154202ywe.166.1443042453490; Wed, 23 Sep 2015 14:07:33 -0700 (PDT) Received: from mtj.duckdns.org ([2620:10d:c091:200::9:106a]) by smtp.gmail.com with ESMTPSA id x185sm5623324ywa.26.2015.09.23.14.07.31 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Sep 2015 14:07:33 -0700 (PDT) Date: Wed, 23 Sep 2015 17:07:29 -0400 From: Tejun Heo To: Artem Bityutskiy Cc: Theodore Ts'o , axboe@kernel.dk, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, lizefan@huawei.com, cgroups@vger.kernel.org, hannes@cmpxchg.org, kernel-team@fb.com, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, Dexuan Cui Subject: [PATCH cgroup/for-4.3-fixes] cgroup, writeback: don't enable cgroup writeback on traditional hierarchies Message-ID: <20150923210729.GA23180@mtj.duckdns.org> References: <1434495193-31182-1-git-send-email-tj@kernel.org> <1434495193-31182-3-git-send-email-tj@kernel.org> <20150722035620.GD2944@thunk.org> <1443012552.19983.209.camel@gmail.com> <20150923180934.GE26647@mtj.duckdns.org> <20150923185137.GJ26647@mtj.duckdns.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20150923185137.GJ26647@mtj.duckdns.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP inode_cgwb_enabled() gates cgroup writeback support. If it returns true, each inode is attached to the corresponding memory domain which gets mapped to io domain. It currently only tests whether the filesystem and bdi support cgroup writeback; however, cgroup writeback support doesn't work on traditional hierarchies and thus it should also test whether memcg and iocg are on the default hierarchy. This caused traditional hierarchy setups to hit the cgroup writeback path inadvertently and ended up creating separate writeback domains for each memcg and mapping them all to the root iocg uncovering a couple issues in the cgroup writeback path. cgroup writeback was never meant to be enabled on traditional hierarchies. Make inode_cgwb_enabled() test whether both memcg and iocg are on the default hierarchy. Signed-off-by: Tejun Heo Reported-by: Artem Bityutskiy Reported-by: Dexuan Cui Link: http://lkml.kernel.org/g/1443012552.19983.209.camel@gmail.com Link: http://lkml.kernel.org/g/f30d4a6aa8a546ff88f73021d026a453@SIXPR30MB031.064d.mgd.msft.net Tested-by: Artem Bityutskiy Tested-by: Dexuan Cui Acked-by: Jens Axboe --- Hello, So, this should make the regression go away. It doesn't fix the underlying bugs but they shouldn't get triggered by people not experimenting with cgroup. I'm gonna keep digging the underlying issues but this should make the regressions go away. If it's okay, I think it'd be better to route this through cgroup/for-4.3-fixes as it's gonna cause a conflict with for-4.4 branch and handling the merge there is easier. Thanks. include/linux/backing-dev.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index 5a5d79e..d5eb4ad1 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -252,13 +253,19 @@ int inode_congested(struct inode *inode, int cong_bits); * @inode: inode of interest * * cgroup writeback requires support from both the bdi and filesystem. - * Test whether @inode has both. + * Also, both memcg and iocg have to be on the default hierarchy. Test + * whether all conditions are met. + * + * Note that the test result may change dynamically on the same inode + * depending on how memcg and iocg are configured. */ static inline bool inode_cgwb_enabled(struct inode *inode) { struct backing_dev_info *bdi = inode_to_bdi(inode); - return bdi_cap_account_dirty(bdi) && + return cgroup_on_dfl(mem_cgroup_root_css->cgroup) && + cgroup_on_dfl(blkcg_root_css->cgroup) && + bdi_cap_account_dirty(bdi) && (bdi->capabilities & BDI_CAP_CGROUP_WRITEBACK) && (inode->i_sb->s_iflags & SB_I_CGROUPWB); }