Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3784339ybi; Mon, 29 Jul 2019 12:33:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqxZgOFDk/ngEePUr1uxb4G/NP+H2UzavKB7oHZ8wsXqdDWIfuG8OsPVtUxl8YaAwUNWOhFx X-Received: by 2002:a17:902:968d:: with SMTP id n13mr64412277plp.257.1564428820084; Mon, 29 Jul 2019 12:33:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564428820; cv=none; d=google.com; s=arc-20160816; b=0sgQGcuuhkg8dhQGiXLqfwvyo1lnBVWO6s6iv9MhGRzuKfwfHub1tOA1NM0G5FXWec JUqNRw0habaChuDjD2OhNcvLMvlDk3N7bg0skMheg7s3V8jW7JnjqcJY+hctkAAhxii2 q2ULS0sv6kmPVkabaTol3gTylJJshHMuJX1zmpUZq+DNgTRKMvwep8I4D+aVf+GX0Ui0 eVgu9yyQPrZG/UATplpwshvZLCVGq2zRDBwm0xrmUIRKR7sdk51+74wqnckOk1XO4JmN q4KIG84FnS7r7oGLB4GUwffF7RuPhpw998ROSTlIl89kavRBxlJXkddZ6tEaMys2Y2YM oHUg== 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=ss0uD2o2Huw5gdMuzLTOM3aNtxPKtuRw5pqFLS8os+c=; b=bamQsYYTQ1qyoxPy0v9ainrEeg2EYSvFP1x5AoBFAOGjwAjeM89h1JyY0Sx1zSiTr3 lhnbZG2opjMrKQaEVSDf/94bLmLVT8ipcuriecFN9gM7LLL+PygTkss/Pgmy1vsp6RUl GZxFBlz2Ef51BWM+MzgQ5mzaGxhjGezGM/3yKErscKIc6719sBfzAv/kextU7i6nKNU8 JxLpsMyRBkVfPseCItMHxK9bB8cpJd8Rwj9ikykvD4ar47cFZ9APMGQXepz5tgz0uSpq EFEnzWOZhka0rv2YQdFsjQXj2dTJ7MLCDNOpZ7liecAykMDEuHNwmpvL/CY8NCb6jBWv N4Dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TRGnuTwS; 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 c13si24565539plz.242.2019.07.29.12.33.24; Mon, 29 Jul 2019 12:33:40 -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=TRGnuTwS; 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 S1729061AbfG2T0J (ORCPT + 99 others); Mon, 29 Jul 2019 15:26:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:38484 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388324AbfG2T0F (ORCPT ); Mon, 29 Jul 2019 15:26:05 -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 3F5B421655; Mon, 29 Jul 2019 19:26:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564428364; bh=LXsBI1nP7aC1KOGbkxAHfjXu8m/BrtXHKl3pF47vSZY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TRGnuTwS2M2tLFXk3JcbGPcFXygIK3pieEH/CoteqpHGyfHGKj+dgwOJRGxqpM0mt ukCaoezLwPQdEHxpzJqsVF0/DW/X/HGfh5H6fPSLfH8rl0W9dicOwGby2OyH9izA9Z 3NlVWEBXTOq6/+QaHtu3DZwQ0jRt/swvQEOmULDk= 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.14 051/293] blkcg, writeback: dead memcgs shouldnt contribute to writeback ownership arbitration Date: Mon, 29 Jul 2019 21:19:02 +0200 Message-Id: <20190729190827.527765441@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@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 4d561ee08d05..9e8fde348d61 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