Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp18625628ybl; Fri, 3 Jan 2020 06:03:40 -0800 (PST) X-Google-Smtp-Source: APXvYqwl9tn0GuE10M3t6oiN/MCmOtskYItDla8IkVshRQSOV+QiKGL/MlHWebQ6L878/fZVbUQd X-Received: by 2002:aca:b1d5:: with SMTP id a204mr3814753oif.82.1578060220137; Fri, 03 Jan 2020 06:03:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578060220; cv=none; d=google.com; s=arc-20160816; b=TR8ZQbWTof85Is9HbQfgb/o7sHFRss2UvBg0+MHfGAnx+f1T97PSqI+pxwRV9MN1Sw XLGr+RUetWeTGOSf1E945Jmx4rUDz+pKlDKWvCcjnEO2ql1JUjg2HRgQVSbYL3Pz/7qg kXQPDAQ1jXih1IYOzbn+R45wNM8S+RmKawyznOa2SSxfzsmM3V+6aVyhDES97AtP/Wv0 keTlJNsWaHUhbE6pvGqcbfrd7zGPtXqE9ud0bbkRvqW1FD5p9zunFkyGL2cyYbajC89y mxsTEOELbZV8uYW1p1jsQQD5eNjf5nTkNlx1oUzTbdBZXCghWgDtcbFO5RwP3fgv7yZd JAdg== 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; bh=RKUd7hKq17THRyKVZFjmFjQq7l01geAHFHun8Sb0C4k=; b=t4fUvxb2IAp58k/AiD7dpcOnit75bCcSqmbkhIFGdDi5L8TNa3obCPeTirYGCZ3lAT WeKJQhsrQW01+56GS9imCGwNKF3mWbERgd/yGb0xl2ZfTr4X3rT7fV6SRNLD55K2+xiE YkPXVZdGP3BtVdOStPRCBfj6qs5JXI/qWMRbDKwxS+9C9WkV97fLgI1bxmRwMnMdQgsP r8L6/Mj95y+fXeMpzaV6wvhKlyQ0fmM14+YMPCXB52aP1uAzPmIF8LvkPFwL7uOedC/+ AW9fG/ZyR9VxZ6fNNTsUX2PySY6Ry81gLChGSt4kX9G2ortlYo8GjPKyeM9Kr/yVmLSl Grrw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a14si24106835oid.58.2020.01.03.06.03.26; Fri, 03 Jan 2020 06:03:40 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727670AbgACOB3 (ORCPT + 99 others); Fri, 3 Jan 2020 09:01:29 -0500 Received: from mga17.intel.com ([192.55.52.151]:35509 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727539AbgACOB2 (ORCPT ); Fri, 3 Jan 2020 09:01:28 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jan 2020 06:01:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,390,1571727600"; d="scan'208";a="252597773" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga002.fm.intel.com with ESMTP; 03 Jan 2020 06:01:26 -0800 Date: Fri, 3 Jan 2020 22:01:28 +0800 From: Wei Yang To: "Kirill A. Shutemov" Cc: Wei Yang , 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: <20200103140128.GA26268@richard> Reply-To: Wei Yang References: <20191223222856.7189-1-richardw.yang@linux.intel.com> <20200103071846.GA16057@richard> <20200103130554.GA20078@richard> <20200103132650.jlyd37k6fcvycmy7@box> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200103132650.jlyd37k6fcvycmy7@box> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 03, 2020 at 04:26:50PM +0300, Kirill A. Shutemov wrote: >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. Sorry for my poor English. I don't catch the meaning of the last sentence. "within noise" here means non-huge PMD is an expected scenario and we could tolerate this? > >> >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 -- Wei Yang Help you, Help me