From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCEBBC432C0 for ; Thu, 28 Nov 2019 21:09:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 66BD021774 for ; Thu, 28 Nov 2019 21:09:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZgDPhWsc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 66BD021774 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BE2036B0555; Thu, 28 Nov 2019 16:09:48 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B92CA6B0556; Thu, 28 Nov 2019 16:09:48 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A81226B0557; Thu, 28 Nov 2019 16:09:48 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0172.hostedemail.com [216.40.44.172]) by kanga.kvack.org (Postfix) with ESMTP id 8FF386B0555 for ; Thu, 28 Nov 2019 16:09:48 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id 3624A8249980 for ; Thu, 28 Nov 2019 21:09:48 +0000 (UTC) X-FDA: 76206928056.16.burn12_386c22c15d64d X-HE-Tag: burn12_386c22c15d64d X-Filterd-Recvd-Size: 4878 Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by imf25.hostedemail.com (Postfix) with ESMTP for ; Thu, 28 Nov 2019 21:09:47 +0000 (UTC) Received: by mail-wm1-f65.google.com with SMTP id g206so12213561wme.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=iwMx0nLf2jRcFp63N+TpyP3ZNk0ZEY16jG8Ss7Tz4XNNd2ylGw47CuBPHut9xlDhOk +Ilu9gl20eoyr8e80HYekKiT5ijNeXoFVEglb7oSqB0rULhFCAWxoT++vevKlUWY9/zW YOnLC8jmhYiyQVNVq4bMn4Ht3qZhDmzMHBM+8BN8oo3fhsx/U169u9F0/6o1PDyMGuuj sxB46rUn/imAoVZZ0EJJM3V8Ad2vsRjIf2APzautBUl+vddvA8gE/ZtxPl0bLH3Cspho gwQAJFhrhRWG26ADQf7PNy3ObNE2Gu1j29Sep4HqueMeUXhuI7CgRCKhTmIi1wKtknwW T7JA== X-Gm-Message-State: APjAAAWQCFBWkjD/wtZOICGwibj0dkOA+4++1UX9m0ZnaOE1+/D05Bsy B4JxVG0kmUX1hP2UwPC0lfU= X-Google-Smtp-Source: APXvYqyS89F0s6JFqZytNEucDsM0gk9nocHLgmJ/EpitSZoWjoHjvq46Dtb1SXtNxY24JweOx4dD8g== 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) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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