Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp110664ybx; Wed, 30 Oct 2019 12:08:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqzNCVfuv/stmNZp4IaLahrgpVdQt4uSVyrNE+6hiApUssn/lyi4MDUWkET5WIsMKdTin3TS X-Received: by 2002:a17:906:4c52:: with SMTP id d18mr1131794ejw.291.1572462480782; Wed, 30 Oct 2019 12:08:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572462480; cv=none; d=google.com; s=arc-20160816; b=AxY35oXR9/D2GCP6MToNacT5N0ce/8ASCqlYtBNY8Im7izno93Zp20IrsInI9Yy1Ft p34dSd3uKAhphV6QkmYYeW4VJJzI1aEAmLqOsYKZR+gKNP97kiqE/SwBmuYx1UQIG4DV 7UZIhtbe5yrDWrpdtCvHZeD3GCTBq6TwuOOtxeQmFJAsNKCkdKVqt03o9xbiqAY5uq+J NBp8AFahwGS59b1nENR3ZUTX5Jk8tTyYXYlCMb4373Gy4fyoXYNIa0FehHd91/i5cQgq pqltT279WWp/lP3SX/oSne7msBsXu5KNYZzR9t+cf+BwG0+G1XFfho55ywJ+28ahlXao 8n/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=A6yVuPB6LXuICIv7poxF2BAaptyD1Hihg4TrEeI9+Jw=; b=dNO2y29Cr4UIkSc674ni9QAD2Tnpsr2WB4m70z76QUwFhvb/vU4Tb9FjrX3/5ZEaXZ 7NVJU/03OWaMe8CWdqrU0VYErz15nrIFckIjK6XBTiL0jgrFar74WatQP0+aThc6LE3y 2uQiWgFPRksmxKuFk0NZAGywIiFYPe7O/R+vFNqV3Wy/RsmEuzSKleKPnEPQrIHmCxz2 yALWmghM4xCudZDUVo/kfZtnVEGCXueIIWQ8quUbHUcfVukDlYZ7mVg5rg7CqboovAeE tInUcSmn1Jy0AIZqE9aQ2fngKhJ7gQANp3fXOiHneIw5tK5ooGbAsZNC6OLcoR9xSIAm hgUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=sozm5qle; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p15si1965261ejo.212.2019.10.30.12.07.36; Wed, 30 Oct 2019 12:08:00 -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=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=sozm5qle; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727153AbfJ3Ro6 (ORCPT + 99 others); Wed, 30 Oct 2019 13:44:58 -0400 Received: from mail-qk1-f194.google.com ([209.85.222.194]:35349 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726479AbfJ3Ro6 (ORCPT ); Wed, 30 Oct 2019 13:44:58 -0400 Received: by mail-qk1-f194.google.com with SMTP id h6so3666330qkf.2 for ; Wed, 30 Oct 2019 10:44:57 -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=EE5gZPUCeEJZGqRuggK31pJZmqYHDMvvbFSC9N72i6PRWSxOdBZZBHmpUPXzgrdsBZ PLDKOUSBnCEbnvh+1TGAbdC5/b0MGoz9UsLZautGERnIj4vFPpETsB2KFP28UvR8BuOA pdcX8tsWys9kofAp9cTkhR9I2YMR3d1isNRcDI8Jp0hf+Tvfro8Mnd3EhCsaofLtM1/I m/+/7L65ekYx9fbCtXNSvsR7R0gwIRReM+HGGG35vqQpUxT2vy04+Go9r7bBNUsrRh+H AKB0d9tCbi+CqV5VklOPdOAr2TBk9iwOI/4t2I5nsfBk2/Pm2U8lAIqoLmKgofpX+Bgz vYcw== X-Gm-Message-State: APjAAAXhLZ1VftkF94vzbYK68BPGGioptXerpywwHnFCWaa0P7kl0QvB NK1T6XygFReRVZedj8SbWAaLWg== 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) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.