Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1675357ybh; Tue, 14 Jul 2020 04:30:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaFDTPO/0pWtrjMzoWpyBvGmfoLPNirgWQOPXTrl/d8UPjdkMfqN1CX1cziWKqWFo8gobX X-Received: by 2002:aa7:d58c:: with SMTP id r12mr4238020edq.160.1594726239630; Tue, 14 Jul 2020 04:30:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594726239; cv=none; d=google.com; s=arc-20160816; b=dRzwbhD8s3GMcKoWWvKOLnJ4JT0ueRCVB1AKVvY6jnazTsG64xnAKq2az52lu+Do+e YwsVM+OzrOSvhcOqxJQjbcdhPEzjRh3Jzu+gb/6O/WjlKrFuj+uOm6PVx0Oa/pS7fSW4 G2EKgcXtgsPG+790JD3Ha62cBS8uXnSfaSroEuDSDEVD+uzmnGD073GAJDmqjWTlIiQh EZcFn1ykjiLTK/CrpyaQ4wru8TOA5SOq3BSRqMxL1IiaPD8oqUwXGQXNgERwg4jyjnxo LqF6OrZIiGbfapm14kAoEomBCFVon3GGcGoW7RXgvbNiCmi+2hXcwAydMlKWi5swMhv0 ukqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=WRuLFKvQDaw1sZL3IQ7c0WjQdAQsHCg8KMZ60fQDX3s=; b=XGFytrWGzoydxJL0BSDbwcqyGJwEtuenB0CBXC6oDwQ+iAXfm+rShn1i+f423g7x4P B1wDYZsBbglrrjFBZYOymF3Xn2dfseljHkEJNzPZbVR9nq7ngmmA6pC3yXKkAEqcYwOs GOyTFii6WGAmwcHNc8/xly6xA/DuNSWWnD3Nxrs83tVVJBm4MJ329DXDhbz/hU0JEEdh fW3Gh0pvXIkL6oL2E4KzSpJc2euy3SMhOI9XlkXczw18SpVLuOvjkBl8CBYvnyYgS+ck tWBg/Tr5DfGxVTCQMf9c+mib5zRKi6INK0vEQyXKt5WWuraM10NIJtxTMjinMWVLbUct D7pQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IvWTr1G8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lc19si10816121ejb.584.2020.07.14.04.30.15; Tue, 14 Jul 2020 04:30:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IvWTr1G8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727067AbgGNL1l (ORCPT + 99 others); Tue, 14 Jul 2020 07:27:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726354AbgGNL1k (ORCPT ); Tue, 14 Jul 2020 07:27:40 -0400 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B4EEC061794 for ; Tue, 14 Jul 2020 04:27:40 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id b25so22030909ljp.6 for ; Tue, 14 Jul 2020 04:27:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WRuLFKvQDaw1sZL3IQ7c0WjQdAQsHCg8KMZ60fQDX3s=; b=IvWTr1G8MbRGNvmmF3GY36Q3iShIoAcmF57XjtqSMlX+UjsveepMcNyeYiicFU+3E+ bOSSCqYtoFqjo48izwzZCRfWncfuq8FFX4ZqMpjYPlN0DXZQAn/uvQY+8tWFxBm4nQam biWrkcFebp86rk2x+UCbWrFkPpCtZl4Om/XQnX76mubHorOPHg8ALbs3ZdV2Tqtt4CDU xB74Epl7L2Ddpc9UFfC+3qdjiFaxKde5OlQzlkOvvSfKv62WKARQGEf135nJb1Pg2Mo1 23YiVG67fLpJQ5Q/2V5JmibKAzCtpBzjkEqkCL73RuAwhHw6ElJUCyx+wzJlEMs++D6D jxow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WRuLFKvQDaw1sZL3IQ7c0WjQdAQsHCg8KMZ60fQDX3s=; b=OLgc9FjzkkVytKeKCWYGIbj3TEKuUFQWA5Z1LgnRVW6/WPgwJJDM7BEljH5wUr+4WB VQfLON3EoRuykD+rhBlw60ZH3NNyQplVXZ+6+jNY13YggbKyKH/61KPMV1/G++9GB3B1 D5oEWNGxIGA930/uLXmqTPBBdR6J4NY6CfrID7Q+ONIDGe8IViut7NQiLAR5P4hVk2BQ vr2cpGvZGo11V5QOebrbUmFW89ZuA9OavKMpze4SzGKjM2T0pK+8qHbytRgCeRkSl8j8 5H9cE4tlsyxbUFzwIIGeP4sdy/MPY+RkHVxpLqzsJPy88RH4Mf4nsgA0eyGAXBga3LtR DCig== X-Gm-Message-State: AOAM532u4vt6bUTnMYlBp41AT2tu3vjWa2uc+vsI+6Q51t5k4w59YkPB iSPQRnj8gVGu3Dy8MqbcAPCsT7IobxYoRyUSpHh0sw== X-Received: by 2002:a2e:9089:: with SMTP id l9mr2090256ljg.431.1594726058377; Tue, 14 Jul 2020 04:27:38 -0700 (PDT) MIME-Version: 1.0 References: <20200712215041.GA3644504@google.com> <20200714073306.kq4zikkphqje2yzb@box> In-Reply-To: <20200714073306.kq4zikkphqje2yzb@box> From: Naresh Kamboju Date: Tue, 14 Jul 2020 16:57:26 +0530 Message-ID: Subject: Re: WARNING: at mm/mremap.c:211 move_page_tables in i386 To: "Kirill A. Shutemov" Cc: Linus Torvalds , Joel Fernandes , linux- stable , open list , linux-mm , Arnd Bergmann , Andrew Morton , Roman Gushchin , Michal Hocko , lkft-triage@lists.linaro.org, Chris Down , Michel Lespinasse , Fan Yang , Brian Geffon , Anshuman Khandual , Will Deacon , Catalin Marinas , pugaowei@gmail.com, Jerome Glisse , Greg Kroah-Hartman , Mel Gorman , Hugh Dickins , Al Viro , Tejun Heo , Sasha Levin Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 14 Jul 2020 at 13:03, Kirill A. Shutemov wrote: > > On Sun, Jul 12, 2020 at 03:58:06PM -0700, Linus Torvalds wrote: > > Anybody else have any opinions? > > Maybe we just shouldn't allow move_normal_pmd() if ranges overlap? > > Other option: pass 'overlaps' down to move_normal_pmd() and only WARN() if > see establised PMD without overlaps being true. > > Untested patch: This patch applied on top of Linus mainline tree and tested on i386. The reported warning did not happen while testing LTP mm [1]. > > diff --git a/mm/mremap.c b/mm/mremap.c > index 5dd572d57ca9..e33fcee541fe 100644 > --- a/mm/mremap.c > +++ b/mm/mremap.c > @@ -245,6 +245,18 @@ unsigned long move_page_tables(struct vm_area_struct *vma, > unsigned long extent, next, old_end; > struct mmu_notifier_range range; > pmd_t *old_pmd, *new_pmd; > + bool overlaps; > + > + /* > + * shift_arg_pages() can call move_page_tables() on overlapping ranges. > + * In this case we cannot use move_normal_pmd() because destination pmd > + * might be established page table: move_ptes() doesn't free page > + * table. > + */ > + if (old_addr > new_addr) > + overlaps = old_addr - new_addr < len; > + else > + overlaps = new_addr - old_addr < len; > > old_end = old_addr + len; > flush_cache_range(vma, old_addr, old_end); > @@ -282,7 +294,7 @@ unsigned long move_page_tables(struct vm_area_struct *vma, > split_huge_pmd(vma, old_pmd, old_addr); > if (pmd_trans_unstable(old_pmd)) > continue; > - } else if (extent == PMD_SIZE) { > + } else if (!overlaps && extent == PMD_SIZE) { > #ifdef CONFIG_HAVE_MOVE_PMD > /* > * If the extent is PMD-sized, try to speed the move by > -- > Kirill A. Shutemov ref: https://lkft.validation.linaro.org/scheduler/job/1561734#L1598 - Naresh