Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1106381ybi; Fri, 2 Aug 2019 09:24:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqwU7iZaBpPm/bPyKIjMQPPz/eVT58kv5IdALKvC1+bpo8sqLaTTGtRUdBtlm8/FARf88ZFL X-Received: by 2002:a17:902:2ac7:: with SMTP id j65mr133266792plb.242.1564763051594; Fri, 02 Aug 2019 09:24:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564763051; cv=none; d=google.com; s=arc-20160816; b=FRHXK19D0dg5iln/p6ZJNYUipK7boOjNP5R8dzADvMIFy8iSRka+lmuhgLEjn/toAp 9BYOfxvC3/O35b530JTCBjInfdtobiwol2VAYuWStwHeiEK22l3RDRBZy4mBgIu5PCtx AtIdQRyNvYa1fzU1MvA3WdjA3PBNaE3h09w8tm8JpdQC95uo1oTJ70vsm2IAywovp3Oz WVD6uwSoRkugPDUaKKxvGA1f9a84brWifKvfn4mc9hI/H2KmhoiGJGTahuZpTlMsDkMV sKfoVFaemkjfHZgbAfAZWn10R9g6HZFbMvOtAESmrBUW6ZCZTDZvE2t3joRUMm9THNQt M88w== 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=XmmLb/qljMcmSVFLH7HUqBCo72U2ErTrTPazstKE8HE=; b=z7VsQfpv1f8DpZh7BeA4DKt2Hje7o+ntLJP3+h/rMghHskskl0UBmYJJ0CiQ2G8maG AAdOBWL7Ti16923ZqtcM7rV1v/A9QqZpn/Fsimxw+SR5NaDdEiuk53oLFLw7IihxcSjn WTH75gL4ehPSWfL7Rm+ewOEUEKgsv1RNkW+MmSbg0Kex4+qVqiuZ69e8Fe0KDFrYLnsr swaLPV/d+04Uv4Ft37moPOH0EBplp2DvW/6VJm0XH4BD2IAkfu6dz09eftxQL10K8PK5 X8OAcHIX/j/dT0wzJViONEtdDnyEUdHzNQUkPOCGOwOphG3D5VWdx5+S9Nhu9SmFmZSk amQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PBBWOMhm; 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 o1si34856986pld.278.2019.08.02.09.23.56; Fri, 02 Aug 2019 09:24:11 -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=PBBWOMhm; 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 S2404883AbfHBJlo (ORCPT + 99 others); Fri, 2 Aug 2019 05:41:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:43462 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404638AbfHBJlk (ORCPT ); Fri, 2 Aug 2019 05:41:40 -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 9DD3A216C8; Fri, 2 Aug 2019 09:41:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564738900; bh=8fO4uo0G2CV+ZvGY0zTfoB37ZOd/j21ctKjBMLC1zsk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PBBWOMhmTNhOS9UcRKwGhSPftBk4zNI61CK+qywxhY1/8zZHxXoqAZGVrU024Q/Fx /uOhezZNkGZf9Najz7S9MIy2uRKZgfVntwLCw9eT6gpQo3mmgj3qatqVPe7z/MZv5C cmOOi4aPqgiPQK3PxPmNqpn0S9k3kdZdPwOJcnaU= 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 4.9 039/223] blkcg, writeback: dead memcgs shouldnt contribute to writeback ownership arbitration Date: Fri, 2 Aug 2019 11:34:24 +0200 Message-Id: <20190802092241.520935390@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190802092238.692035242@linuxfoundation.org> References: <20190802092238.692035242@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 8b93d4b98428..baaed9369ab4 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