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.3 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,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 7CEE4CA9EC7 for ; Wed, 30 Oct 2019 17:45:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3B8F9217D9 for ; Wed, 30 Oct 2019 17:45:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg-org.20150623.gappssmtp.com header.i=@cmpxchg-org.20150623.gappssmtp.com header.b="sozm5qle" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3B8F9217D9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cmpxchg.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C52896B0003; Wed, 30 Oct 2019 13:44:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C02AC6B0007; Wed, 30 Oct 2019 13:44:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AF1706B0008; Wed, 30 Oct 2019 13:44:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0123.hostedemail.com [216.40.44.123]) by kanga.kvack.org (Postfix) with ESMTP id 883546B0003 for ; Wed, 30 Oct 2019 13:44:59 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id 2D807181AF5C4 for ; Wed, 30 Oct 2019 17:44:59 +0000 (UTC) X-FDA: 76101176718.15.bath24_488603f39f926 X-HE-Tag: bath24_488603f39f926 X-Filterd-Recvd-Size: 5413 Received: from mail-qk1-f196.google.com (mail-qk1-f196.google.com [209.85.222.196]) by imf25.hostedemail.com (Postfix) with ESMTP for ; Wed, 30 Oct 2019 17:44:58 +0000 (UTC) Received: by mail-qk1-f196.google.com with SMTP id m16so3281451qki.11 for ; Wed, 30 Oct 2019 10:44:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=A6yVuPB6LXuICIv7poxF2BAaptyD1Hihg4TrEeI9+Jw=; b=sozm5qleGziX428szkw/H+7If3/x7loBPpt2oW5IYALdZ5UQ01sEahdB3jplMrxsZP 8fkP990UWGINNKWje1T4f34YF9bVU4CocJAZRe0X6x9G225pyXyZnEYlJCtSHi60PaGA 8xaOS1bCBt7dv+wXrcuytT6FOgqh2+DWU2Ib/zQKKFJRs7AN/rfFqn8yG/WuHsy+aqSM QOxb3zm841f/ZAP+4vCwBLxyu/4qHsWqYzju81lMDLtfsdk7p56sfVOJmU0IcjFYg4fY rFXxUpjxn4seusqGZzzFOSmhawfWX3VxePsC9Z5RLg6BdcH4X2d4YiOBfaIKt+nYFuVl Ry1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=A6yVuPB6LXuICIv7poxF2BAaptyD1Hihg4TrEeI9+Jw=; b=WyoXecJWbVhLp0PR7cmUwmvMlWuZv0GWo5uigC/s3DFTtRrqegj/QzggMOuFvKRlYJ zJkjS25Ny5tg2jb6zmTSJ2Njbh7WSbPudSDNYHVxR6R6ZFRUlpQxNVeUV7AWupwngdwN 4zVDE2bPX75GbRJL353kUx3qk2iALcvpsw2kRDsA6fwDugW+IymXnRsiFVLjQB0kJUKr rQqnqvFzYhE5Fyvw/wo8kkTTF4UJf1/NMc0fYMgnccprS+nGHusUwrMTMP4cnJVhMkhb kKenr9FyVpPUzDMlJ84exMDn8nFzpGQ6irUSsq5iT69SSeVeeTiBaVU0LAZNfHvvBLQB RQ6A== X-Gm-Message-State: APjAAAX8PvE+Lx6G9RUukaa//dQ40N9Gyc4uErzYCSOsFvRHTYH7obd3 JzQvyYcc0JoxIsX/jCnxqM9YFA== X-Google-Smtp-Source: APXvYqxuyncJaALPCXtj3n2azDg0h+QVUSTGonCFW3/bvuRX1ZRhsMSbKmid5pM8JPhvxb2afrYisg== X-Received: by 2002:a05:620a:12bb:: with SMTP id x27mr1126516qki.459.1572457497275; Wed, 30 Oct 2019 10:44:57 -0700 (PDT) Received: from localhost (pool-108-27-252-85.nycmny.fios.verizon.net. [108.27.252.85]) by smtp.gmail.com with ESMTPSA id z17sm614026qtj.95.2019.10.30.10.44.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Oct 2019 10:44:56 -0700 (PDT) Date: Wed, 30 Oct 2019 13:44:55 -0400 From: Johannes Weiner To: Shakeel Butt Cc: Greg Thelen , Roman Gushchin , Michal Hocko , Andrew Morton , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, syzbot+13f93c99c06988391efe@syzkaller.appspotmail.com Subject: Re: [PATCH] mm: vmscan: memcontrol: remove mem_cgroup_select_victim_node() Message-ID: <20191030174455.GA45135@cmpxchg.org> References: <20191029234753.224143-1-shakeelb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191029234753.224143-1-shakeelb@google.com> User-Agent: Mutt/1.12.2 (2019-09-21) 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 Tue, Oct 29, 2019 at 04:47:53PM -0700, Shakeel Butt wrote: > Since commit 1ba6fc9af35b ("mm: vmscan: do not share cgroup iteration > between reclaimers"), the memcg reclaim does not bail out earlier based > on sc->nr_reclaimed and will traverse all the nodes. All the reclaimable > pages of the memcg on all the nodes will be scanned relative to the > reclaim priority. So, there is no need to maintain state regarding which > node to start the memcg reclaim from. Also KCSAN complains data races in > the code maintaining the state. > > This patch effectively reverts the commit 889976dbcb12 ("memcg: reclaim > memory from nodes in round-robin order") and the commit 453a9bf347f1 > ("memcg: fix numa scan information update to be triggered by memory > event"). > > Signed-off-by: Shakeel Butt > Reported-by: Excellent, thanks Shakeel! Acked-by: Johannes Weiner Just a request on this bit: > @@ -3360,16 +3358,9 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *memcg, > .may_unmap = 1, > .may_swap = may_swap, > }; > + struct zonelist *zonelist = node_zonelist(numa_node_id(), sc.gfp_mask); > > set_task_reclaim_state(current, &sc.reclaim_state); > - /* > - * Unlike direct reclaim via alloc_pages(), memcg's reclaim doesn't > - * take care of from where we get pages. So the node where we start the > - * scan does not need to be the current node. > - */ > - nid = mem_cgroup_select_victim_node(memcg); > - > - zonelist = &NODE_DATA(nid)->node_zonelists[ZONELIST_FALLBACK]; This works, but it *is* somewhat fragile if we decide to add bail-out conditions to reclaim again. And some numa nodes receiving slightly less pressure than others could be quite tricky to debug. Can we add a comment here that points out the assumption that the zonelist walk is comprehensive, and that all nodes receive equal reclaim pressure? Also, I think we should use sc.gfp_mask & ~__GFP_THISNODE, so that allocations with a physical node preference still do node-agnostic reclaim for the purpose of cgroup accounting.