Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp7214680ybc; Thu, 28 Nov 2019 13:12:49 -0800 (PST) X-Google-Smtp-Source: APXvYqxCQq1FNqUtkrCU0uQ+kMKyg/V2tyspnqQz+S0fAdLXmIdCJcubHk2P6wjjX7Ye6Ps1NjS0 X-Received: by 2002:a17:906:b74c:: with SMTP id fx12mr54385834ejb.324.1574975569211; Thu, 28 Nov 2019 13:12:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574975569; cv=none; d=google.com; s=arc-20160816; b=W30x24P8hbbMDHDlWtFeJXuTC90N2NIdv8Geq8rTLaQ4FFWaEAQSqow4NsxkXGtw4e JvgPjMp0PgqjRbjLIln/HuSEDYcB6UvrCNpzDZ3Wfy7V+DWxJhtFdWo5GzwmjgYbmUYY s/vUyI2s0JQK7dgDLq2/Tac3W8XV2ydJ1gK/0cnh0KZnTt4EOZbQ+m/WRPDkiSuWWJg1 6Y6G9Vc+QdM0EKuDzkt6JNkqki1SHJxHHSstXd2WIcsDBvUorKOF7LJhe+wFaMGZD9j/ tRMZONj1eHXrr/Fn5W2AlBzXfbPoQfteGPUCInIV06y4vRQ2Di/2OMfPhiC8rl6b9IJH pVDw== 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:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=fvP7YYOdK1ePA2WQ5BUbpUZAWIQExoAhCyARQj2svqk=; b=lQYyb7n6a+xMLk3I7N1xB6JNtck0yLY5uX/phWJIsjny4j6i6rYUFQtIPvGS694PTN IX1Cgqd9t86gNMiC3W6d/LW2rgTgap1QleksrMl53vBlPUrcyyVz/dgeVuVB1UbU/gV4 PIsEnx3v/D9H3ZbXxF/Dxvvvuzy08FLeWgv5IYBPuQ7sOekm+y26OQGz+K0ckeGhjg0W zAIDQr7KUF+NpLBs5Xv6xQXUx5Cb3Z1aHnbNJmhmGomFK6BSLDVvxoKbdMoP5+zaN9YP HIqq3iALAQBgB1THRihUlRWu37sLTS9MQFABKhUxhWL23VG+nHLovNc+eB3faDJsIa94 Dwhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZgDPhWsc; 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 r18si12343253eja.211.2019.11.28.13.12.24; Thu, 28 Nov 2019 13:12:49 -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=ZgDPhWsc; 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 S1726716AbfK1VJu (ORCPT + 99 others); Thu, 28 Nov 2019 16:09:50 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:33968 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726583AbfK1VJu (ORCPT ); Thu, 28 Nov 2019 16:09:50 -0500 Received: by mail-wm1-f65.google.com with SMTP id j18so8269588wmk.1 for ; Thu, 28 Nov 2019 13:09:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:reply-to:references:mime-version :content-disposition:in-reply-to:user-agent; bh=fvP7YYOdK1ePA2WQ5BUbpUZAWIQExoAhCyARQj2svqk=; b=ZgDPhWscTy1hbhcPyyEQwl2dtVvvQJOUYREXFDWJAfgLmaFE5ZLOoL9eb7qwl7Krc3 Yobp6fO7nlHvnfpScoKpEFnNqsl8A7DbIkMd263E0HCBZyzIYXEunm1I4aG5ZUHY28jA 60QB6yTy+Xu+OSjhnr/wPXjf+N35U/8Gt+358nlaJHVTsmoN6mke/L3L+hXXS5QNsVLL SQTTcMarglQf4C+OWn4pEcEbAV2xQCNHwgAd5+loikj0WPhqDMJDmD6tLABFS6uVsFfR nYmUIm/p9C7Vlxnhs7Et3fBmKkXsfmShsTtrhPmryoiBBr+XslqN1VddzLgorqlBa1dw WDPQ== 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:reply-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=fvP7YYOdK1ePA2WQ5BUbpUZAWIQExoAhCyARQj2svqk=; b=AuyjPaMxL1HViwe3y2c9+f0W+HRaC+WjXDfwVNpdp5IJVJ2K4JhaGiwr400Kd9P3pP UBxnhBvSYitkDw1EhnHKV4Q0HYNTAhzRZZaiPdtZcNjgBMh+1gf34XexQWT1UaL2SWfm zSAmL6eKUBy/MPR16c08epEIontl5Z0oh9BLFCLCWc02Z6aK5q8KVGSKwXOet+eNglgg sjEMldJryKythx0G5M3P522SD/oBxojCUrpscKgYwIyrkCOXsVsMndywqVtRGlhc+kIC gSn6u5CvdmZTWahKI6l66zN0ummGfLpW+0gTr7tggSy1nvFDbBo7/ilVW0txQCBLsdjR g8+A== X-Gm-Message-State: APjAAAVBNFGw7Sf4C13OvuJPky2UYEFHh9fz2fMqh7ox7QsTtUG5U3Xr 5N5Z9+wyKAK+GiyeM0Jb2+r6pvVx X-Received: by 2002:a7b:c757:: with SMTP id w23mr11055593wmk.63.1574975386427; Thu, 28 Nov 2019 13:09:46 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id u22sm5861161wru.30.2019.11.28.13.09.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Nov 2019 13:09:45 -0800 (PST) Date: Thu, 28 Nov 2019 21:09:45 +0000 From: Wei Yang To: "Kirill A. Shutemov" Cc: Wei Yang , akpm@linux-foundation.org, kirill.shutemov@linux.intel.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] mm/page_vma_mapped: page table boundary is already guaranteed Message-ID: <20191128210945.6gtt7wlygsvxip4n@master> Reply-To: Wei Yang References: <20191128010321.21730-1-richardw.yang@linux.intel.com> <20191128010321.21730-2-richardw.yang@linux.intel.com> <20191128083143.kwih655snxqa2qnm@box.shutemov.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191128083143.kwih655snxqa2qnm@box.shutemov.name> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 28, 2019 at 11:31:43AM +0300, Kirill A. Shutemov wrote: >On Thu, Nov 28, 2019 at 09:03:21AM +0800, Wei Yang wrote: >> The check here is to guarantee pvmw->address iteration is limited in one >> page table boundary. To be specific, here the address range should be in >> one PMD_SIZE. >> >> If my understanding is correct, this check is already done in the above >> check: >> >> address >= __vma_address(page, vma) + PMD_SIZE >> >> The boundary check here seems not necessary. >> >> Signed-off-by: Wei Yang > >NAK. > >THP can be mapped with PTE not aligned to PMD_SIZE. Consider mremap(). > Hi, Kirill Thanks for your comment during Thanks Giving Day. Happy holiday:-) I didn't think about this case before, thanks for reminding. Then I tried to understand your concern. mremap() would expand/shrink a memory mapping. In this case, probably shrink is in concern. Since pvmw->page and pvmw->vma are not changed in the loop, the case you mentioned maybe pvmw->page is the head of a THP but part of it is unmapped. This means the following condition stands: vma->vm_start <= vma_address(page) vma->vm_end <= vma_address(page) + page_size(page) Since we have checked address with vm_end, do you think this case is also guarded? Not sure my understanding is correct, look forward your comments. >> Test: >> more than 48 hours kernel build test shows this code is not touched. > >Not an argument. I doubt mremap(2) is ever called in kernel build >workload. > >-- > Kirill A. Shutemov -- Wei Yang Help you, Help me