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=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, 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 BC07FC433DB for ; Tue, 5 Jan 2021 18:24:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4527122D06 for ; Tue, 5 Jan 2021 18:24:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4527122D06 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9CEFC8D0093; Tue, 5 Jan 2021 13:24:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 97F448D006E; Tue, 5 Jan 2021 13:24:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 895A88D0093; Tue, 5 Jan 2021 13:24:05 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0095.hostedemail.com [216.40.44.95]) by kanga.kvack.org (Postfix) with ESMTP id 73B728D006E for ; Tue, 5 Jan 2021 13:24:05 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 234283626 for ; Tue, 5 Jan 2021 18:24:05 +0000 (UTC) X-FDA: 77672545650.29.juice74_10057e0274db Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin29.hostedemail.com (Postfix) with ESMTP id ADBFD18086CD4 for ; Tue, 5 Jan 2021 18:24:04 +0000 (UTC) X-HE-Tag: juice74_10057e0274db X-Filterd-Recvd-Size: 4761 Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Tue, 5 Jan 2021 18:24:03 +0000 (UTC) Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 105IMPch017473; Tue, 5 Jan 2021 18:24:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=hyFa/4h7ZfFa7XfAmz+235g28tyEl69ByzZFYqIEh1I=; b=YWtNPvhBYVxOB71nV/P2LR+rRYvrpsi+yadtFvC8a3FIA2gPIZWHRqU76Wz675HDo/gJ Mi+Lc/AOrvaCFdXzjsaZf/5wx/93vcY26KLRSONooBh9VsCPwb8sc7uJEx1HqGRIl6m/ l0kKoivBfQ2oES0qSjUQpcOkrlgxG2UZEWG4NjZeHs0oQJ4oIvQINH9QQzczE7gOrJ1s LQjM608+mSQ0l3affG2ijVsDN5bSH3iUcgqnBOIHNY1TPxqX1+D2REEVZlhV09EkgJmo DQno5+g5NwMD2wUhvJeYbhZDNLYFL96WU3BbJWx33xRt8eElV7x2GSAs+KiiNlNuv8/a tg== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 35tg8r24xc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 05 Jan 2021 18:24:01 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 105IGOFp105800; Tue, 5 Jan 2021 18:24:01 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 35v4rbq96b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 Jan 2021 18:24:01 +0000 Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 105IO0q7004817; Tue, 5 Jan 2021 18:24:00 GMT Received: from [192.168.2.112] (/50.38.35.18) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 05 Jan 2021 18:24:00 +0000 Subject: Re: [PATCH V2] mm/hugetlb.c: fix unnecessary address expansion of pmd sharing To: Li Xinhai , linux-mm@kvack.org Cc: akpm@linux-foundation.org, Peter Xu References: <20210104081631.2921415-1-lixinhai.lxh@gmail.com> From: Mike Kravetz Message-ID: Date: Tue, 5 Jan 2021 10:23:59 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <20210104081631.2921415-1-lixinhai.lxh@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9855 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 mlxscore=0 bulkscore=0 suspectscore=0 spamscore=0 adultscore=0 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101050107 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9855 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 phishscore=0 bulkscore=0 spamscore=0 impostorscore=0 suspectscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 lowpriorityscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101050107 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 1/4/21 12:16 AM, Li Xinhai wrote: > The current code would unnecessarily expand the address range. Consider > one example, (start, end) = (1G-2M, 3G+2M), and (vm_start, vm_end) = > (1G-4M, 3G+4M), the expected adjustment should be keep (1G-2M, 3G+2M) > without expand. But the current result will be (1G-4M, 3G+4M). Actually, > the range (1G-4M, 1G) and (3G, 3G+4M) would never been involved in pmd > sharing. > > After this patch, we will check that the vma span at least one PUD > aligned size and the start,end range overlap the aligned range of vma. > > With above example, the aligned vma range is (1G, 3G), so if (start, end) > range is within (1G-4M, 1G), or within (3G, 3G+4M), then no adjustment > to both start and end. Otherwise, we will have chance to adjust start > downwards or end upwards without exceeding (vm_start, vm_end). > > Fixes: 75802ca66354 ("mm/hugetlb: fix calculation of adjust_range_if_pmd_sharing_possible") > Suggested-by: Mike Kravetz > Cc: Mike Kravetz > Cc: Peter Xu > Signed-off-by: Li Xinhai > --- Thanks again. Comments and discussion in previous thread. Reviewed-by: Mike Kravetz -- Mike Kravetz