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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD48AECAAD8 for ; Wed, 21 Sep 2022 09:29:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4BBCA80008; Wed, 21 Sep 2022 05:29:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 46B4480007; Wed, 21 Sep 2022 05:29:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3599A80008; Wed, 21 Sep 2022 05:29:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 224C580007 for ; Wed, 21 Sep 2022 05:29:52 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id D7A7B1408EA for ; Wed, 21 Sep 2022 09:29:51 +0000 (UTC) X-FDA: 79935570582.11.91037C5 Received: from out30-43.freemail.mail.aliyun.com (out30-43.freemail.mail.aliyun.com [115.124.30.43]) by imf27.hostedemail.com (Postfix) with ESMTP id 207DC40005 for ; Wed, 21 Sep 2022 09:29:49 +0000 (UTC) X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R311e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046050;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=12;SR=0;TI=SMTPD_---0VQNbdKx_1663752585; Received: from 30.97.48.63(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VQNbdKx_1663752585) by smtp.aliyun-inc.com; Wed, 21 Sep 2022 17:29:46 +0800 Message-ID: <41579b3d-00a4-d3ba-ea7a-21d6d147e018@linux.alibaba.com> Date: Wed, 21 Sep 2022 17:30:03 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH v3] hugetlb: simplify hugetlb handling in follow_page_mask To: Mike Kravetz , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-ia64@vger.kernel.org Cc: David Hildenbrand , Christophe Leroy , "Aneesh Kumar K . V" , Naoya Horiguchi , Michael Ellerman , Muchun Song , Andrew Morton References: <20220919021348.22151-1-mike.kravetz@oracle.com> From: Baolin Wang In-Reply-To: <20220919021348.22151-1-mike.kravetz@oracle.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663752591; a=rsa-sha256; cv=none; b=BW1QYM+LGhRM4BaGbGGs0mrjRR9EwAM6rSzU+S9EPhTItaYB4or5TxRFMCJ8QZ8O4r3a26 gUIf1xvqzYy0ERktkicBtDEtOdAAozfMxuKgoosqGQddC9FrYDGPlNjDsLqkF3yP1dvrPG xdOt4FN9pC3yV3qZppoidZQMmpLGZ5s= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf27.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.43 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663752591; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jPWZ+j6faVb9jREdxYVArWoCM7B8Dix/9MSWLodwvL4=; b=0lsWQ1aYIPQSJAZSTf8ITr6cSsexAvUs4xs/sK3TPhz68ozvMKSRLo4+40HqLpR6W3kXEu jpRN6dXhHNq3pHYqZIdWC/yst68Ko5SPBCt0CjbDOxr6e13GSgo7YUTzjdkmLwX5ly73hD 5sOnelDWSA2WvCCU2QmvkhKOPu20HA4= X-Rspamd-Queue-Id: 207DC40005 Authentication-Results: imf27.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf27.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.43 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com X-Rspamd-Server: rspam08 X-Rspam-User: X-Stat-Signature: hyeye4swfmp47jotbnhcok13humoeg5z X-HE-Tag: 1663752589-253593 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 9/19/2022 10:13 AM, Mike Kravetz wrote: > During discussions of this series [1], it was suggested that hugetlb > handling code in follow_page_mask could be simplified. At the beginning > of follow_page_mask, there currently is a call to follow_huge_addr which > 'may' handle hugetlb pages. ia64 is the only architecture which provides > a follow_huge_addr routine that does not return error. Instead, at each > level of the page table a check is made for a hugetlb entry. If a hugetlb > entry is found, a call to a routine associated with that entry is made. > > Currently, there are two checks for hugetlb entries at each page table > level. The first check is of the form: > if (p?d_huge()) > page = follow_huge_p?d(); > the second check is of the form: > if (is_hugepd()) > page = follow_huge_pd(). > > We can replace these checks, as well as the special handling routines > such as follow_huge_p?d() and follow_huge_pd() with a single routine to > handle hugetlb vmas. > > A new routine hugetlb_follow_page_mask is called for hugetlb vmas at the > beginning of follow_page_mask. hugetlb_follow_page_mask will use the > existing routine huge_pte_offset to walk page tables looking for hugetlb > entries. huge_pte_offset can be overwritten by architectures, and already > handles special cases such as hugepd entries. > > [1] https://lore.kernel.org/linux-mm/cover.1661240170.git.baolin.wang@linux.alibaba.com/ > > Suggested-by: David Hildenbrand > Signed-off-by: Mike Kravetz LGTM, and works well on my machine. So feel free to add: Reviewed-by: Baolin Wang Tested-by: Baolin Wang