Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2617524ybl; Sun, 26 Jan 2020 06:49:31 -0800 (PST) X-Google-Smtp-Source: APXvYqzsvb+Erv4Zwe/LYv0OqZ332/RXUfpD8/brSL370MfIo1lQzgjNdU0lB4H70Yf4IPlHL9rY X-Received: by 2002:a9d:7592:: with SMTP id s18mr9820421otk.130.1580050171375; Sun, 26 Jan 2020 06:49:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580050171; cv=none; d=google.com; s=arc-20160816; b=o+VvMsP8TfXrrfdFC53xz06dl+F8yl84TKI81uDtsDQxVOsMyFXclsFUk5V/X+75ZT ej5Uy0OyRIJYbp38+iGBu066c3GC5fdrckjEOM7wQrcCcxnGMU2tG11bmm3E75gdcXUJ 2JGLMU86NSUdluyVeHD8qjRJrbtx0WLXGo86/tLoE+SJxuQbnxlX5JLSWCHq8+u2Dill U77yGVRIrmg0S8L1Pr0eyklwPeL6AB36E5TBoCDayFJbb+8WFzckDF6HEMdMu2cXOi17 XvfmyZ6g2OujkCMcJAMDvf55LKIt+Fz2dvjjqYTDVYycZEJrO7yf7rCfDAo68T3DtNnS DVJQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=suFPTFq/Jnh/uA1mB3Xjj1yJvj/WmXz4zUasdh/U3Lw=; b=nMD0t6QJOkEOku762YCg+wypCuyBmcFn/rOpqvj2bFd2ZfIy63AC/rmy4yROiaelwO feEMJNtMtSmWOrJZDtcMHXjzv0mKpXZcwbYYnpa4wHUZalXs/fAzBE44z74iBzLbULXJ x0U9BztgPLP5C7aAvZYkkN7cQ93oagjuo4/tao0iE+aprL/dcL0ygl9fwLisgbjvvRyV Zqt2i0NFhjTLW2boBPAbXrERze6sczJthzMVF2aViiDxzaqtVTxcDVDDaF2Urw/wquew bSwI+SlCypDNg9RtMZxk9elPWskwK4PROKgmTNEuvfI0Ol8G+h1PeCiwa8KRYGdtrs2c nRqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TE6agYmJ; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v16si2162442oiv.114.2020.01.26.06.49.17; Sun, 26 Jan 2020 06:49:31 -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=@gmail.com header.s=20161025 header.b=TE6agYmJ; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726087AbgAZOsI (ORCPT + 99 others); Sun, 26 Jan 2020 09:48:08 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:39978 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725773AbgAZOsI (ORCPT ); Sun, 26 Jan 2020 09:48:08 -0500 Received: by mail-lf1-f67.google.com with SMTP id c23so4399597lfi.7; Sun, 26 Jan 2020 06:48:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=suFPTFq/Jnh/uA1mB3Xjj1yJvj/WmXz4zUasdh/U3Lw=; b=TE6agYmJp5GFdw08Vzg+NV/vbjFAQN87TqO+KUwG+SSpOn/QXw2O5iYkI4V5wBFOd7 MskcQuJgz9OYUgTc3wCtEzUgVduImNspswoMR5iF6Aeljkj9x8+Ij6OYsZMeJPtuBt0q dusBuy9L/4jdf/rIl4Ugr8l3im2nUCt42fx1+bieysOkOovSmCUZ9hhChAnDUD5Wl47C A7zbiIfv6LDY6pcR+3eNEpeqzKBmMVG/i4T8YB8k6ehvMx6mruuC75qtvzU6oRRJ0u9s FcptOHkL02y1q8s1Tw0K95zwucg+aW2S+pCCrs0TgJmPCWAif56/0YZyDJm7kR6nU8Ot eREA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=suFPTFq/Jnh/uA1mB3Xjj1yJvj/WmXz4zUasdh/U3Lw=; b=Gnv8h4mubjMtEXQQUY/GKkMCNKHPaq87xzfDRC2DhpyIhmmGs4oJ4QJPLjGsJqO6Nr mSUlP8cJnXZS8SbQDhdlOL/hTjA6JYneq1JaG9RBsDIbrrpYbBMWOOKiEzTGFqwyGFce qhKprE8X+yUj41K8DsAGHGRuC22d55Yi6BtIQ94M4VlHK12mBQFUiR00cnDD80eRDyn1 dXrz0kNZwhe8cfnUT5yPGJ7KenlLCVr/Q8jdwxs//p2U3/W3yTdevPfWLxpUA2yVQa7h kjjyIOgEuBluWV7Moqo+zc8jWYK1y8oTsL7TsHyUOFsXTji4fC4hlUyke5AQjxLXY1Ez KYSQ== X-Gm-Message-State: APjAAAUGNtZvILcMdwCenrqTyQ8QNfkiemSfhUoUAiOSaHLx+VU50eq5 Jd94U0Zi4iDKcxUrCbmOZ7g= X-Received: by 2002:ac2:4839:: with SMTP id 25mr5664498lft.192.1580050086365; Sun, 26 Jan 2020 06:48:06 -0800 (PST) Received: from [192.168.2.145] (79-139-233-37.dynamic.spd-mgts.ru. [79.139.233.37]) by smtp.googlemail.com with ESMTPSA id z14sm6594934ljm.86.2020.01.26.06.48.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 26 Jan 2020 06:48:05 -0800 (PST) Subject: Re: [PATCH 3/5] mm/mremap: use pmd_addr_end to calculate next in move_page_tables() To: Wei Yang , akpm@linux-foundation.org, 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 Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, "linux-tegra@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Russell King - ARM Linux References: <20200117232254.2792-1-richardw.yang@linux.intel.com> <20200117232254.2792-4-richardw.yang@linux.intel.com> From: Dmitry Osipenko Message-ID: <7147774a-14e9-4ff3-1548-4565f0d214d5@gmail.com> Date: Sun, 26 Jan 2020 17:47:57 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: <20200117232254.2792-4-richardw.yang@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.