Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1912506ybi; Sat, 25 May 2019 11:30:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqyU3OtAcM3gEItQU494GT0fCl+GOO0keN7+K5nifmYeQt6yo/aQxEbrLvQd7fARp5RKIQSW X-Received: by 2002:a17:90a:b283:: with SMTP id c3mr18320823pjr.28.1558809024884; Sat, 25 May 2019 11:30:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558809024; cv=none; d=google.com; s=arc-20160816; b=la8otPsNf2ta71x/aaaMpMp580kmV6Iaw7PNN8el5Ob64hDsCa/MNi7XKSKGdl0Dju AsE0CSUNBV4vj/yfOt6+lk5lW/fmUHL0Vlj6XyhQLAXYXvLHLLYWP5J3+kzU2ck1qgdv v0lTky2++aaRWuQAEGzsVArOjtHGt1rGYxC+g7wqAuSlol+3jJEWvoGx4Ay/iTe2QXAV pbxIHtxsip/lHiqhI1pElwdC2zsZxV3nJ1Ly8G4PXMD3W2l78ZzFN3YZCOkO0GXereIy 4uMF6TICTWFB1CAo8cWVxaiV85lGouCs64L8Mv17NIW17FX4uS4wKZhrPFMdAmzlDtnv oTtA== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=w+IdEmKygnVp1QBgdc+S50lSqkJXJd/uGfLdmX1z2mI=; b=CelfsFGKinszvs86zJo3ScW2FxF1EbSPj20xI4SV6X9B8K2MnZpPCZTFnqbLzE5I4u MI69q+48TejpJwF2nqcqp3kgPcKD+VPRCiVI3YNlBk7j0/Pl58IHf81ARmzm3nCPB71P v6pTRKiZzZtse5Dk6wCYO1KvDHFjIhaItVIgMzSTEV6b79+5NbkQl2vKkdFIyhdOYG4r Qz2+4KCxa5Cm5fRzABo30vLRrKmVu/BL19KgTgU+Du/Ys5s32HO97IaJfUd/hYZaQzT/ LLA4zdcAbhaURvNAS2RCV0DB/MMbyKPgT8Xv4HPzo1vWARwZAYukv4Y+3bdMmyKOQM1N 53dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=c268qRQW; 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 l70si9491994pjb.33.2019.05.25.11.30.07; Sat, 25 May 2019 11:30:24 -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=c268qRQW; 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 S1727311AbfEYS2x (ORCPT + 99 others); Sat, 25 May 2019 14:28:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:48960 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725730AbfEYS2x (ORCPT ); Sat, 25 May 2019 14:28:53 -0400 Received: from localhost.localdomain (c-73-223-200-170.hsd1.ca.comcast.net [73.223.200.170]) (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 EDAB320863; Sat, 25 May 2019 18:28:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558808932; bh=o915ziI83Wq3DsJM16MhIJ37dE0MX7hNkXvLF1mxSSs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=c268qRQWAtxOlxLXaieeHQKVwLydKfkQ1kaOAyUmD8rZ5kPgeuW35L3VundqMz2ws TKpWRCTzZ8coWST9lgDMHXMzGATDQxarTquKm4ZuZQkbKIhDrGjeXU+rXigaTuPjPT LPC2G49gKq0gH2eeygnFjTHww2cX8TsGOwqjPKMc= Date: Sat, 25 May 2019 11:28:51 -0700 From: Andrew Morton To: zhong jiang Cc: , , , , , , , , Vlastimil Babka Subject: Re: [PATCH] mm/mempolicy: Fix an incorrect rebind node in mpol_rebind_nodemask Message-Id: <20190525112851.ee196bcbbc33bf9e0d869236@linux-foundation.org> In-Reply-To: <1558768043-23184-1-git-send-email-zhongjiang@huawei.com> References: <1558768043-23184-1-git-send-email-zhongjiang@huawei.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org (Cc Vlastimil) On Sat, 25 May 2019 15:07:23 +0800 zhong jiang wrote: > We bind an different node to different vma, Unluckily, > it will bind different vma to same node by checking the /proc/pid/numa_maps. > Commit 213980c0f23b ("mm, mempolicy: simplify rebinding mempolicies when updating cpusets") > has introduced the issue. when we change memory policy by seting cpuset.mems, > A process will rebind the specified policy more than one times. > if the cpuset_mems_allowed is not equal to user specified nodes. hence the issue will trigger. > Maybe result in the out of memory which allocating memory from same node. > > --- a/mm/mempolicy.c > +++ b/mm/mempolicy.c > @@ -345,7 +345,7 @@ static void mpol_rebind_nodemask(struct mempolicy *pol, const nodemask_t *nodes) > else { > nodes_remap(tmp, pol->v.nodes,pol->w.cpuset_mems_allowed, > *nodes); > - pol->w.cpuset_mems_allowed = tmp; > + pol->w.cpuset_mems_allowed = *nodes; > } > > if (nodes_empty(tmp)) hm, I'm not surprised the code broke. What the heck is going on in there? It used to have a perfunctory comment, but Vlastimil deleted it. Could someone please propose a comment for the above code block explaining why we're doing what we do?