Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10614502ybi; Thu, 25 Jul 2019 02:27:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqzHgtLYpaoyOx2PBAGnVWwEuEsY78pe3cHnq1tTLO51qVrJzaEYSqyVY7rRIIFWnaX4kAWx X-Received: by 2002:a17:90a:d14a:: with SMTP id t10mr51949652pjw.85.1564046824707; Thu, 25 Jul 2019 02:27:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564046824; cv=none; d=google.com; s=arc-20160816; b=0Ir/HOq/Z9lvKWaHk126d7Nl2fzJeLtM+4viPb3bUiPz/VyaqVcZJwIthLyFs2JIcr BdEx5js5uWZ0dQOmyIKI1wq4PRvLT9ZrGaE5znoNIOCCsYjlb2QxNmzes6pjuMN4cQdH Inh0kT1ocQrFBsjlaS52cRTkiMiYOJ/lxD1SepQ3WYfMBYVsCsjEOIjrfTcSkUWRHKVN mOogdyiPsWDouC66FNl5iQ48u1qQ6yGhPU+6KsIAsNoZoBoo7qV4wuDojAN8HanMpPX/ 4oG6uzcAwyqbw0EwoEgGrNiCgo5uyLvDPeJcD/LQXm0ynLVGJiBYJ18MY/x/BeoWEORl gNiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=m3NBwc4rlLQDN6RPfHCOFRKx2FdUkjmps/VzFeNl0bc=; b=zxtTCEZtXhYfcSpfJJbZmPt9ckopLfzjpuj4V4L+7ET91tLCQj4xhsSLzjca0t9IVW O8m6kX6ifMgS8uwvSov7TPNWBXi8KX0RKCSxRjVg05Tiv/OfGTzoVIG/9ZJV/2wT+ApY L9/2K0W43P8de8+CJWSm2/nrOjjAIYd8NQqgo+46r1s465u3ti4gPxYGOl7tNzDwdckX bxyExxqv68pIN4MiKacvkr75OZLwDK0VFkUZIJMU2FWidfKFlMLiBG9KkY2kEPAEBBj3 Tk0LqOGNaHKaXEYU1ISvcKzGtlXbGlPUFt0H5MDlQcqwQ8ntAmmrlY9c04PC1fYyKViv O2Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Jlzz/8gE"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bx21si18030909pjb.21.2019.07.25.02.26.45; Thu, 25 Jul 2019 02:27:04 -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=@kernel.org header.s=default header.b="Jlzz/8gE"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389375AbfGXUdh (ORCPT + 99 others); Wed, 24 Jul 2019 16:33:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:45776 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728690AbfGXT1u (ORCPT ); Wed, 24 Jul 2019 15:27:50 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A62C5218EA; Wed, 24 Jul 2019 19:27:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563996469; bh=S0E1UF06q68jC3495q+jItdIe+mk+gE5PVWPHXe/fOw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jlzz/8gEPdLJZGUegcxQHh+IbFfgO9Oay771K0IM9UG8PEqqRIOCnAQkgr3cfOsh5 G4HbM028oHMbf/yNy+rmIUVFLyRPNKFEKzI6uvrole5Ze0irQo0ydARxsHJbPKe7Az a5cEQpXIxjMwTfCbZT0FW5ykh5g3ooHeSOZ0csIg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tejun Heo , Jan Kara , Jens Axboe , Sasha Levin Subject: [PATCH 5.2 106/413] blkcg, writeback: dead memcgs shouldnt contribute to writeback ownership arbitration Date: Wed, 24 Jul 2019 21:16:37 +0200 Message-Id: <20190724191742.860548714@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191735.096702571@linuxfoundation.org> References: <20190724191735.096702571@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 6631142229005e1b1c311a09efe9fb3cfdac8559 ] wbc_account_io() collects information on cgroup ownership of writeback pages to determine which cgroup should own the inode. Pages can stay associated with dead memcgs but we want to avoid attributing IOs to dead blkcgs as much as possible as the association is likely to be stale. However, currently, pages associated with dead memcgs contribute to the accounting delaying and/or confusing the arbitration. Fix it by ignoring pages associated with dead memcgs. Signed-off-by: Tejun Heo Cc: Jan Kara Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- fs/fs-writeback.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index e41cbe8e81b9..9ebfb1b28430 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -715,6 +715,7 @@ void wbc_detach_inode(struct writeback_control *wbc) void wbc_account_io(struct writeback_control *wbc, struct page *page, size_t bytes) { + struct cgroup_subsys_state *css; int id; /* @@ -726,7 +727,12 @@ void wbc_account_io(struct writeback_control *wbc, struct page *page, if (!wbc->wb) return; - id = mem_cgroup_css_from_page(page)->id; + css = mem_cgroup_css_from_page(page); + /* dead cgroups shouldn't contribute to inode ownership arbitration */ + if (!(css->flags & CSS_ONLINE)) + return; + + id = css->id; if (id == wbc->wb_id) { wbc->wb_bytes += bytes; -- 2.20.1