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 2CCB7C54EE9 for ; Mon, 19 Sep 2022 07:50:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6C7106B0072; Mon, 19 Sep 2022 03:50:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 676BC940008; Mon, 19 Sep 2022 03:50:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 53DDD940007; Mon, 19 Sep 2022 03:50:18 -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 441B56B0072 for ; Mon, 19 Sep 2022 03:50:18 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 17B2AAB77C for ; Mon, 19 Sep 2022 07:50:18 +0000 (UTC) X-FDA: 79928062116.10.FB87F84 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf06.hostedemail.com (Postfix) with ESMTP id 579A818001D for ; Mon, 19 Sep 2022 07:50:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663573816; h=from:from: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=i/iLQ4kdAhzUU0VWkseG+c5vX7QQyvDlfGs9j2AsJDU=; b=CprqVe/rp9ze0QBx5FTCbH/V3Hsl0I0vrctN1NbxZoB2RVtlc7Lbq/uATpClithEw1rQV0 Fk5PJh9tkeYhADuYrigdia29a6m8RjUpIp4/AQgXjGt2NcXT9jiWqwQlkE8dTljhsszJz1 q+Ghp31CIq7pf9h6XBJ5JMOGAUbMbVw= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-77-mFuAp7alPruv_i1aD0Z7Jw-1; Mon, 19 Sep 2022 03:50:15 -0400 X-MC-Unique: mFuAp7alPruv_i1aD0Z7Jw-1 Received: by mail-wr1-f70.google.com with SMTP id t11-20020adfba4b000000b00226eb5f7564so6315150wrg.10 for ; Mon, 19 Sep 2022 00:50:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date; bh=i/iLQ4kdAhzUU0VWkseG+c5vX7QQyvDlfGs9j2AsJDU=; b=HHm6tu7gn0NuGFcl2mpiimbXEOvUrC9+BUvTYTWQ8Z6CBWxWIUBnFNOT3MynGrM+4d lLXgKBWvQrL9mqQ+8knUj1WnjlVd6H71ldZyAv2r9TxyGtjo67pCKY4Q3PBpgHnl5YGu LPSfvwp0EAwGPRTw6i/G8zrW3NgMSEvGwpnw01epyufudmPAeO+7+scv7xfZIoIrsayD PBZQ/kMYxH7c5tE7Lg6zkZV90tKaUjSze/ahy+aOkyHVKmpXBxkrz8yirmBAQRya26Bm S+KxClj/wwy0WNrHmea1PKTi2Gaoh/OnAnfe3Xn7S2a8e8pge0S+0uEoX7M3Uw3wBpAG Cdmg== X-Gm-Message-State: ACrzQf0qwi8FBfCp/szFaEHxVM54sKUz3R9DXBjE4zI5ZpPZFuqWWDCn ng/EKrjNP2XxwD8jwscoOio7JXqOO7tVSLlr65IdaAlMVvMtHhpWynrEvwGZ92o7JKd8FVKKJyo h+Ldha7QOw/4= X-Received: by 2002:adf:a50e:0:b0:22a:ede1:57e with SMTP id i14-20020adfa50e000000b0022aede1057emr5797013wrb.63.1663573814678; Mon, 19 Sep 2022 00:50:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM69yWPQ71p10ovzZwsnci+6il7uBFgZ4x37tHZjCyhjLk1+HnJ2naaRkgKbADZjLobyfndxig== X-Received: by 2002:adf:a50e:0:b0:22a:ede1:57e with SMTP id i14-20020adfa50e000000b0022aede1057emr5796994wrb.63.1663573814405; Mon, 19 Sep 2022 00:50:14 -0700 (PDT) Received: from ?IPV6:2003:cb:c703:c100:c136:f914:345f:f5f3? (p200300cbc703c100c136f914345ff5f3.dip0.t-ipconnect.de. [2003:cb:c703:c100:c136:f914:345f:f5f3]) by smtp.gmail.com with ESMTPSA id n2-20020a5d67c2000000b0021badf3cb26sm15174363wrw.63.2022.09.19.00.50.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 19 Sep 2022 00:50:13 -0700 (PDT) Message-ID: <3d2fc74b-7496-6691-aec0-8d4ed30df139@redhat.com> Date: Mon, 19 Sep 2022 09:50:12 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 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: Baolin Wang , Christophe Leroy , "Aneesh Kumar K . V" , Naoya Horiguchi , Michael Ellerman , Muchun Song , Andrew Morton References: <20220919021348.22151-1-mike.kravetz@oracle.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: <20220919021348.22151-1-mike.kravetz@oracle.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663573817; a=rsa-sha256; cv=none; b=4Jgi0LIZHMk55N6aAl+jX6CAKMwmBDXunxB2CfYtv+8sO55g+8bmQ3Gu4P6bZFm8oRGYMo 9ikok/gzPcCzt5U0SqAqnu39B8Ykf6asjJFuA0wdR782MTGiWKNikEqvb+yoB1RTxvkGlX VVPDsgWQSHk/k6Gjgk8cYEyYmMWIcd4= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="CprqVe/r"; spf=pass (imf06.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663573817; 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:dkim-signature; bh=i/iLQ4kdAhzUU0VWkseG+c5vX7QQyvDlfGs9j2AsJDU=; b=zAwxwG4V/oTK9JOKyeSxibsk+lvMPrPCsSLsHHRy4opYGiA0m5/RQWNliwtlVGdqf9J5Io 0tSXs1w52jaVvuZTu84o9Zifz9TeZSpSE0UJBoRibxCmj6AHiobauPQhCtIZ34oZn9AHVt yrpOCx2d72ZdrpyikOqnCJU6vE4AKSg= X-Stat-Signature: dj7dj3ufykdmacf35wf49bnwrabysnsd X-Rspam-User: Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="CprqVe/r"; spf=pass (imf06.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 579A818001D X-HE-Tag: 1663573817-561526 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 19.09.22 04:13, 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 > --- Reviewed-by: David Hildenbrand -- Thanks, David / dhildenb