From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E082C76191 for ; Mon, 15 Jul 2019 14:56:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 34DB12067C for ; Mon, 15 Jul 2019 14:56:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563202590; bh=UZazOLY4xLkk2qBr8+dsHkB/Jc4iCiMRLqDD81r72bM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=jRBZP+cUR9xl9Z4TvgF0mSSZqccqoYkvWzZy7pt2GeqV2FlgmqN21ltUktorwGDgX hw8O8TusZTQw6qki9tPndhgFNtm0L/sRX5uF5pvqYsvZroOo9+Gg3EByfdYxV1jnZM Kr08MatXd/HnFjZSINChCH+S4Nqsw8zdQLBZ+f2s= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390589AbfGOOWU (ORCPT ); Mon, 15 Jul 2019 10:22:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:49754 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390274AbfGOOWT (ORCPT ); Mon, 15 Jul 2019 10:22:19 -0400 Received: from sasha-vm.mshome.net (unknown [73.61.17.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A72BA21537; Mon, 15 Jul 2019 14:22:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563200538; bh=UZazOLY4xLkk2qBr8+dsHkB/Jc4iCiMRLqDD81r72bM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TcwtL/YqCHC9B2ikeXDnr/8LSLHM6tCPPSJj+DGH92G9x7BM3FrYjHsD3o86jdXMk BvLMphCUHZT/91vAJp18jnIwwSpU21v73ivjntZ/O7DqtYi28OS5ycehVoJU3vB9WN 6M+q+wmFGPaFMnNTm4RSC09W4FuMYahQwvGdqkWg= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Tejun Heo , Jan Kara , Jens Axboe , Sasha Levin , linux-fsdevel@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 072/158] blkcg, writeback: dead memcgs shouldn't contribute to writeback ownership arbitration Date: Mon, 15 Jul 2019 10:16:43 -0400 Message-Id: <20190715141809.8445-72-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190715141809.8445-1-sashal@kernel.org> References: <20190715141809.8445-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Tejun Heo [ 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 9544e2f8b79f..7ee86d8f313d 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -721,6 +721,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; /* @@ -732,7 +733,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