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=-9.5 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 D847EC433DB for ; Wed, 6 Jan 2021 00:49:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 78659206C0 for ; Wed, 6 Jan 2021 00:49:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 78659206C0 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 DAC218D00CC; Tue, 5 Jan 2021 19:49:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D848B8D006E; Tue, 5 Jan 2021 19:49:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C9A038D00CC; Tue, 5 Jan 2021 19:49:31 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0117.hostedemail.com [216.40.44.117]) by kanga.kvack.org (Postfix) with ESMTP id B42958D006E for ; Tue, 5 Jan 2021 19:49:31 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 7E8AA8245571 for ; Wed, 6 Jan 2021 00:49:31 +0000 (UTC) X-FDA: 77673516942.12.week72_1c0083c274dd Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id 621ED1801FF1F for ; Wed, 6 Jan 2021 00:49:31 +0000 (UTC) X-HE-Tag: week72_1c0083c274dd X-Filterd-Recvd-Size: 4553 Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Wed, 6 Jan 2021 00:49:30 +0000 (UTC) Received: by mail-lf1-f51.google.com with SMTP id o17so2868477lfg.4 for ; Tue, 05 Jan 2021 16:49:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=vjq74ef12VUiKlyP7FiRTm/p+hMP/pE8S3AUqEZM+Ds=; b=SWOz4luajz8tWSRIWnXg9tz7Uwy32rHfMGZRis5NIxTILhATzGxvh5Y7ZLwPq72YbW 8sTRcE/lhT1EOp4iSoE/3k/P0E3iimykrfnsD4JEKE5K4xT/m1oX1Cd8xYGb+5Pr7iTw c/TknL6TDezhRKWKpHxFKTpJacOm+dxzQkYHwto/CGehfbw9fgbu/RThHEM5NODoZhXv Q7+znjse7ofFJ8DkN69DCj0LlgTH4FrmW4xIj45O6fyNFPSvZTZEzt8TIvtXrZdUvA8r Q0kF64giz5pk4z8IwLn3BODG6VMBGpblrOKJRV4vYYn2QvnqvzrnhWywDzQUyQDl5BjB pPfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=vjq74ef12VUiKlyP7FiRTm/p+hMP/pE8S3AUqEZM+Ds=; b=QdBvbFDaLR3anYiiX+J2PPu0EOfO4+em8TOvcepefr48RE11q9/Kst8/D06jPUGX2J Dxv5QSIiY7/6nRdnraq4MbJjX5uab6ZYFdX4iCXACewyLkCpqfAqjMpZTh08eBliLpOX A7DlgA0o4P+iGzL+uFNKXU4PPdn7434JUiQ8YDljWKFAHc0AI4DAYdwttHAlPdmIO/HT Nlhi+bWTccHQVgxv9R8gbHjhnPbLfee2zjIKVfhg2TtJD2xHxH2irsr99DLEQkvePmHA KC5OW2mxLc8DlaE6SD2DJhzsPRtDt9a2gHAJZ+vl0iZkbPXRc5R4P7MZgJr3ds5JaQ8+ 37ZA== X-Gm-Message-State: AOAM530M7P9xW3QKLf8ZiersrLB9epmmCR58gGIe2rlaqx/hWbNuaBR5 nNJ4zGQr1dRl+YHUBMrVhl0= X-Google-Smtp-Source: ABdhPJzxyCW0C6UVDo4UCReCmHmIm3tXTQ1jk8G2LreOuygye3qD/ivUdasT1OokmERoP88aBVoHLg== X-Received: by 2002:a2e:96c5:: with SMTP id d5mr881597ljj.321.1609894169614; Tue, 05 Jan 2021 16:49:29 -0800 (PST) Received: from localhost.localdomain ([2a03:5342:f:6::3]) by smtp.gmail.com with ESMTPSA id p18sm85970ljc.40.2021.01.05.16.49.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 05 Jan 2021 16:49:28 -0800 (PST) Subject: Re: [PATCH V2] mm/hugetlb.c: fix unnecessary address expansion of pmd sharing To: Mike Kravetz , linux-mm@kvack.org Cc: akpm@linux-foundation.org, Peter Xu References: <20210104081631.2921415-1-lixinhai.lxh@gmail.com> From: Li Xinhai Message-ID: <165d2f1c-ae61-0125-4dce-90acf9b0a637@gmail.com> Date: Wed, 6 Jan 2021 08:49:19 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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/6/21 2:23 AM, Mike Kravetz wrote: > 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 > Thanks for review.