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=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 49B8EC432C1 for ; Tue, 24 Sep 2019 13:05:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0A39C214AF for ; Tue, 24 Sep 2019 13:05:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0A39C214AF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 70FC46B0006; Tue, 24 Sep 2019 09:05:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6C00C6B0008; Tue, 24 Sep 2019 09:05:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5FC266B000A; Tue, 24 Sep 2019 09:05:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0252.hostedemail.com [216.40.44.252]) by kanga.kvack.org (Postfix) with ESMTP id 376B76B0008 for ; Tue, 24 Sep 2019 09:05:04 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id C4EB98243777 for ; Tue, 24 Sep 2019 13:05:03 +0000 (UTC) X-FDA: 75969834486.10.run94_2c203c453d236 X-HE-Tag: run94_2c203c453d236 X-Filterd-Recvd-Size: 2436 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by imf21.hostedemail.com (Postfix) with ESMTP for ; Tue, 24 Sep 2019 13:05:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C55B618CB8E9; Tue, 24 Sep 2019 13:05:01 +0000 (UTC) Received: from localhost (ovpn-12-49.pek2.redhat.com [10.72.12.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 21DFD19C6A; Tue, 24 Sep 2019 13:05:00 +0000 (UTC) Date: Tue, 24 Sep 2019 21:04:58 +0800 From: Baoquan He To: Michal Hocko Cc: akpm@linux-foundation.org, tj@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v2] memcg: Only record foreign writebacks with dirty pages when memcg is not disabled Message-ID: <20190924130458.GB31919@MiWiFi-R3L-srv> References: <20190923083030.6442-1-bhe@redhat.com> <20190924111138.GA31919@MiWiFi-R3L-srv> <20190924122747.GQ23050@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190924122747.GQ23050@dhcp22.suse.cz> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.63]); Tue, 24 Sep 2019 13:05:01 +0000 (UTC) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 09/24/19 at 02:27pm, Michal Hocko wrote: > On Tue 24-09-19 19:11:51, Baoquan He wrote: > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > > index f3c15bb07cce..84e3fdb1ccb4 100644 > > --- a/mm/memcontrol.c > > +++ b/mm/memcontrol.c > > @@ -4317,6 +4317,9 @@ void mem_cgroup_track_foreign_dirty_slowpath(struct page *page, > > > > trace_track_foreign_dirty(page, wb); > > > > + if (mem_cgroup_disabled()) > > + return; > > + > > This doesn't seem correct. We shouldn't even enter the slowpath with > memcg disabled AFAIC. The check should be done at mem_cgroup_track_foreign_dirty > level. You mean the way in v1 patch, right? It's also fine to me. I am worried about the case that memcg is enabled, the checking by calling mem_cgroup_disabled() will lower efficiency. And it entering into mem_cgroup_track_foreign_dirty_slowpath() should be a rare event. Thanks Baoquan