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=-2.2 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no 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 A272AC2D0CE for ; Fri, 3 Jan 2020 13:26:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 43FDC22314 for ; Fri, 3 Jan 2020 13:26:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=shutemov-name.20150623.gappssmtp.com header.i=@shutemov-name.20150623.gappssmtp.com header.b="dM9v8enp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 43FDC22314 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6EE348E0007; Fri, 3 Jan 2020 08:26:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 678228E0003; Fri, 3 Jan 2020 08:26:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 53F948E0007; Fri, 3 Jan 2020 08:26:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0040.hostedemail.com [216.40.44.40]) by kanga.kvack.org (Postfix) with ESMTP id 3BA628E0003 for ; Fri, 3 Jan 2020 08:26:53 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id E89628249980 for ; Fri, 3 Jan 2020 13:26:52 +0000 (UTC) X-FDA: 76336398264.26.pest09_1c4ba8f82211 X-HE-Tag: pest09_1c4ba8f82211 X-Filterd-Recvd-Size: 5420 Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) by imf32.hostedemail.com (Postfix) with ESMTP for ; Fri, 3 Jan 2020 13:26:52 +0000 (UTC) Received: by mail-lj1-f194.google.com with SMTP id y6so35856033lji.0 for ; Fri, 03 Jan 2020 05:26:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Asw7w06stGi1IWr+2nLUSF6dsNpGXIgVywOg4XUTixQ=; b=dM9v8enpv7GyuZ2hsrNesEW4s7o5vYQXBktWha+pyqwORaOfWN1pg7me9woOGhvBq6 au78hLXhQBpbBaHb16xN67Bo0mD6TRiqX725rlHyLWbH5Klx13nmITqgiuKSqGFNzEKM Gux4vCMbriKaiouV96/w7A5L/Chh1GaaaXbp5JtqxeAAd8uNfe/+0l5+zKWoJHw1JpUj IB8MCisXkiCBYQXIlt0f8lKKgXCIgyKOXkUBtS/wy2+hNfQVNSybR3IuIb0uYzPmfTdx 1ngQnQTm0+wX3j+oW/fHu46/AwmKnHRyhvolxZYDvLNU5FHlJyXwCiJku1exmiJQ7Wbf VByg== 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:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Asw7w06stGi1IWr+2nLUSF6dsNpGXIgVywOg4XUTixQ=; b=XDt71mCb1QLYHHI4BTZgiYOVJIGDOHcBW8eN/4vSXArntw5ZkHoZFEDaoSMwQdUihG d+u5a6HjwywbnL+jphpV1MZkdhRV85fw5Wo1NolR+0GbK7TJoD1SRXh0ssgNOjILFtB7 oWAxKDgKnka3RUUvUue5stKC4m3uPtI4twM3VlIz2nZtDIpdT+3lE7Wc+wlkSPRMsoMm lU9DYz4Yfw2EoBAU3TefHb9ng7Z/FCeTUiXfeUyJ8LKlQ0exg5WZvICBfXHpj518IygL /db4JS+5womXMOvSK5sR55NmG9301ORi31wLxIQNoWFSdJ+W9aw15uCNXTW07kmJSScY 4jaA== X-Gm-Message-State: APjAAAWGJWC1/E5jfpky9FqT6A7TJelOpp6le8Z5WFiYbz66RAG2YCwt QN/yn/i+uC/k4dlCTeAU1JdgQg== X-Google-Smtp-Source: APXvYqzyaB+0xH2PprW+j1uckcEe+g7oN5HDml7PQu7wPmRnyVD+PzLlUL15W0tb+0E8HgmgVwUe1w== X-Received: by 2002:a2e:7816:: with SMTP id t22mr52552757ljc.161.1578058010531; Fri, 03 Jan 2020 05:26:50 -0800 (PST) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id h24sm24490515ljl.80.2020.01.03.05.26.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2020 05:26:49 -0800 (PST) Received: by box.localdomain (Postfix, from userid 1000) id A7B40100741; Fri, 3 Jan 2020 16:26:50 +0300 (+03) Date: Fri, 3 Jan 2020 16:26:50 +0300 From: "Kirill A. Shutemov" To: Wei Yang Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kirill.shutemov@linux.intel.com, willy@infradead.org Subject: Re: [Patch v2] mm/rmap.c: split huge pmd when it really is Message-ID: <20200103132650.jlyd37k6fcvycmy7@box> References: <20191223222856.7189-1-richardw.yang@linux.intel.com> <20200103071846.GA16057@richard> <20200103130554.GA20078@richard> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200103130554.GA20078@richard> User-Agent: NeoMutt/20180716 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000055, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Jan 03, 2020 at 09:05:54PM +0800, Wei Yang wrote: > On Fri, Jan 03, 2020 at 03:18:46PM +0800, Wei Yang wrote: > >On Tue, Dec 24, 2019 at 06:28:56AM +0800, Wei Yang wrote: > >>When page is not NULL, function is called by try_to_unmap_one() with > >>TTU_SPLIT_HUGE_PMD set. There are two cases to call try_to_unmap_one() > >>with TTU_SPLIT_HUGE_PMD set: > >> > >> * unmap_page() > >> * shrink_page_list() > >> > >>In both case, the page passed to try_to_unmap_one() is PageHead() of the > >>THP. If this page's mapping address in process is not HPAGE_PMD_SIZE > >>aligned, this means the THP is not mapped as PMD THP in this process. > >>This could happen when we do mremap() a PMD size range to an un-aligned > >>address. > >> > >>Currently, this case is handled by following check in __split_huge_pmd() > >>luckily. > >> > >> page != pmd_page(*pmd) > >> > >>This patch checks the address to skip some work. > > > >I am sorry to forget address Kirill's comment in 1st version. > > > >The first one is the performance difference after this change for a PTE > >mappged THP. > > > >Here is the result:(in cycle) > > > > Before Patched > > > > 963 195 > > 988 40 > > 895 78 > > > >Average 948 104 > > > >So the change reduced 90% time for function split_huge_pmd_address(). Right. But do we have a scenario, where the performance of split_huge_pmd_address() matters? I mean, it it called as part of rmap walk, attempt to split huge PMD where we don't have huge PMD should be within noise. > >For the 2nd comment, the vma check. Let me take a further look to analysis. > > > >Thanks for Kirill's suggestion. > > > > For 2nd comment, check vma could hold huge page. > > You mean do this check ? > > vma->vm_start <= address && vma->vm_end >= address + HPAGE_PMD_SIZE > > This happens after munmap a partial of the THP range? After doing so, we can > skip split_pmd for this case. Okay, you are right. This kind of check would not be safe as we split_huge_pmd_address() after adjusting VMA with expectation of splitting PMD on boundary of the VMA. -- Kirill A. Shutemov