Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3087423ybl; Sun, 26 Jan 2020 19:01:57 -0800 (PST) X-Google-Smtp-Source: APXvYqzS66SvevrVKYSAki5EDiq47PavyzTOE9WSm8+NfcXDzSNtMJqiE7m69yMJrEi7EPTdKe2N X-Received: by 2002:a9d:624e:: with SMTP id i14mr11305860otk.371.1580094117134; Sun, 26 Jan 2020 19:01:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580094117; cv=none; d=google.com; s=arc-20160816; b=S0IdinSfTc4aSfqevz4wZPlHPF7RBF4Y6G5ue7Fa5SmHXa2JZdbOmHRKbG1hnPfJ7I GK1inuEIUCPxs2mc2AcVE/HsChfm73nKUEsIbrgvsMdsw7Mf76X9JjevSqwfRiobWO+R rr2CG2T/hKtOXWOWT3zYnD9Pvrk1N+9ib7dKPxhskRPsnn5VM0l78Oe3N1OCGb4hVPJw O5SWgLH9gn4X7jGsiP16+n9El0qHYAId7RALFZFhNSSHfhzb5K7+OQY8XRTg+nmQdunb 40BaxrnMgOcKB2lYebaMej3egNVYcXiEBAJdXvqxk90BU17/ar/cg7I5UBAegpOUAuvr yuQg== 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=fpRphykTbjlQkrcpBpbxAOHAweFx5nJPKYnKKVfkqv0=; b=y3rcCz2lXDg7JBY6SIKjyc1j8kk1ESgRWUuKp6cEAsDakDiNelGYO3GPSqqeQJQ+JB RIFXMsflVIm9Hybi/9y1/D+LAjbxrDXeb92+1584rq4J0LOvJBWYpKoiHaW/gbuFD4EJ hkYM4GwMhDnebGABLzl8lUS/yoIvaYb2GSDdGSj85/M2NdBjWqAx/3hyLXKihja2SwjM HIT8HocGO9yIkOzmxEt959L0wdaqUn+3GdnJOytfaOSkW0fGEmEpgB9epXpy9iRbZTE4 sFs+7zr8UZ0bAaIh3JqqfflQgcXH5MUjDXgEJPFYD/sMZM4qzkD1GMYHZR9z3ncj59af RolQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pkR1ldAG; 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 q6si5711249otf.301.2020.01.26.19.01.34; Sun, 26 Jan 2020 19:01:57 -0800 (PST) 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=pkR1ldAG; 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 S1727493AbgA0C7y (ORCPT + 99 others); Sun, 26 Jan 2020 21:59:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:51786 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726545AbgA0C7x (ORCPT ); Sun, 26 Jan 2020 21:59:53 -0500 Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (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 6934F20720; Mon, 27 Jan 2020 02:59:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580093992; bh=Xxe6e1RbtGn4/jUYrlDkK2iVd7wbKVCAUBJPGAeGEvk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=pkR1ldAGILY7ByaZeZKE51wQBHl8Rev9VIgD1Rt2qUp2zzEeiDsmpCWuBmo3k3K/K zT01gJcoa9jeN+LW5t1rUwsYtJ8ULwZKlofyZvEhLrdRV9bcfQ3ZSiC39VrgC+r3vt SzwnOuNGl0WXlnG1/ar5Gqf5ncnnydrUK59NBVg4= Date: Sun, 26 Jan 2020 18:59:51 -0800 From: Andrew Morton To: Dmitry Osipenko Cc: Wei Yang , dan.j.williams@intel.com, aneesh.kumar@linux.ibm.com, kirill@shutemov.name, yang.shi@linux.alibaba.com, thellstrom@vmware.com, Thierry Reding , Jon Hunter , linux-kernel@vger.kernel.org, linux-mm@kvack.org, "linux-tegra@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Russell King - ARM Linux Subject: Re: [PATCH 3/5] mm/mremap: use pmd_addr_end to calculate next in move_page_tables() Message-Id: <20200126185951.c9246349befcccce210a4ab8@linux-foundation.org> In-Reply-To: <7147774a-14e9-4ff3-1548-4565f0d214d5@gmail.com> References: <20200117232254.2792-1-richardw.yang@linux.intel.com> <20200117232254.2792-4-richardw.yang@linux.intel.com> <7147774a-14e9-4ff3-1548-4565f0d214d5@gmail.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=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 On Sun, 26 Jan 2020 17:47:57 +0300 Dmitry Osipenko wrote: > 18.01.2020 02:22, Wei Yang пишет: > > Use the general helper instead of do it by hand. > > > > Signed-off-by: Wei Yang > > --- > > mm/mremap.c | 7 ++----- > > 1 file changed, 2 insertions(+), 5 deletions(-) > > > > diff --git a/mm/mremap.c b/mm/mremap.c > > index c2af8ba4ba43..a258914f3ee1 100644 > > --- a/mm/mremap.c > > +++ b/mm/mremap.c > > @@ -253,11 +253,8 @@ unsigned long move_page_tables(struct vm_area_struct *vma, > > > > for (; old_addr < old_end; old_addr += extent, new_addr += extent) { > > cond_resched(); > > - next = (old_addr + PMD_SIZE) & PMD_MASK; > > - /* even if next overflowed, extent below will be ok */ > > + next = pmd_addr_end(old_addr, old_end); > > extent = next - old_addr; > > - if (extent > old_end - old_addr) > > - extent = old_end - old_addr; > > old_pmd = get_old_pmd(vma->vm_mm, old_addr); > > if (!old_pmd) > > continue; > > @@ -301,7 +298,7 @@ unsigned long move_page_tables(struct vm_area_struct *vma, > > > > if (pte_alloc(new_vma->vm_mm, new_pmd)) > > break; > > - next = (new_addr + PMD_SIZE) & PMD_MASK; > > + next = pmd_addr_end(new_addr, new_addr + len); > > if (extent > next - new_addr) > > extent = next - new_addr; > > move_ptes(vma, old_pmd, old_addr, old_addr + extent, new_vma, > > > > Hello Wei, > > Starting with next-20200122, I'm seeing the following in KMSG on NVIDIA > Tegra (ARM32): > > BUG: Bad rss-counter state mm:(ptrval) type:MM_ANONPAGES val:190 > > and eventually kernel hangs. > > Git's bisection points to this patch and reverting it helps. Please fix, > thanks in advance. Thanks. I had these tagged for 5.7-rc1 anyway, so I'll drop all five patches.