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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 192CEC636D6 for ; Wed, 22 Feb 2023 21:18:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232250AbjBVVSN (ORCPT ); Wed, 22 Feb 2023 16:18:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229468AbjBVVSK (ORCPT ); Wed, 22 Feb 2023 16:18:10 -0500 Received: from mail-vs1-xe36.google.com (mail-vs1-xe36.google.com [IPv6:2607:f8b0:4864:20::e36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AB606E8C for ; Wed, 22 Feb 2023 13:18:09 -0800 (PST) Received: by mail-vs1-xe36.google.com with SMTP id b20so11312881vsu.5 for ; Wed, 22 Feb 2023 13:18:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=otM8qhqUgaC56OL8G3qlw4NF5AhDokREGtXy6YgiFWA=; b=eXV1cQ6JwcBmeQSYFlVACqwetVMSOPxE6Jd2p8DN0Zt4wzQ+k5F4nq5EKJmGG7k+y1 2M+CMNn2TEHBOgYstQYyVi+O9HEeEjbTWUKuJOJGDvt/22beOj089cowScL9hMBd71QC PVNClTGqmvZwYMqPCi0biRPCZqXfMM6bZDEd0sPO/+uP8I9HHzBvh2nZQge+Odf1sxoB CNpQM1JFyKXWHx156KATBlzKC/7mJcI2Ub8AxYq46xGR6wPoIky+K0akrh7zaSlYKZFY 6o2FftsSRZggVQkYrihHo8gcbD3ULni0gy/CxtKhpV3uDIHLrkB2pDf0mcFNnwic2J32 L6+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=otM8qhqUgaC56OL8G3qlw4NF5AhDokREGtXy6YgiFWA=; b=XB805i2DD0ASjKRHrDPuQHYp4o0l+7JyARuhCUTNJgpOxdJpRek2iZh+zPjb6ZhKEH JpDczFOOLLlpAGbAswOMtTIVksJTyrtX9aoEOkS3Uyq8BZRzdPIMFkzjTvLBp/E2mWbp +NQwBuaFWfiQDNApQfDtC6prcjJt/ue14wdjjX3P60PNJe0Jb3S1NCSCPw3j0LYvwyh+ ZwCu8nEIOTTUhZhCmPUkNMW2ChK3CDb1vvL+YSmiy2ZhqoSZT8Q4gomEkFqamVSZU4yI uunk4101DxlLwI8c3UtW8ps1NBinWzOBbZJ5XJ2o7UuXGViV5YclwgGEsG+85IkQzt6k oysA== X-Gm-Message-State: AO0yUKVuwRtmZhECLmmK1rZC5PBnOuvkDPPFxgRmpvibrKcv2utmIY0M eGbAQiCrLszgBBUWkFQKCSAXqAFTIX+tu2SdvgwfSQ== X-Google-Smtp-Source: AK7set9M9yI5gWDrVIc5jaubLhHZ9pdVfZZsdKXZRAudRRYOLYEDgOXrEunt4gpCSfAJkyWSsa2rJruKDiLt8GQXYs8= X-Received: by 2002:ab0:38d3:0:b0:67a:2833:5ceb with SMTP id l19-20020ab038d3000000b0067a28335cebmr2737124uaw.0.1677100688403; Wed, 22 Feb 2023 13:18:08 -0800 (PST) MIME-Version: 1.0 References: <20230218002819.1486479-1-jthoughton@google.com> <20230218002819.1486479-17-jthoughton@google.com> In-Reply-To: <20230218002819.1486479-17-jthoughton@google.com> From: Mina Almasry Date: Wed, 22 Feb 2023 13:17:57 -0800 Message-ID: Subject: Re: [PATCH v2 16/46] hugetlb: make default arch_make_huge_pte understand small mappings To: James Houghton Cc: Mike Kravetz , Muchun Song , Peter Xu , Andrew Morton , David Hildenbrand , David Rientjes , Axel Rasmussen , "Zach O'Keefe" , Manish Mishra , Naoya Horiguchi , "Dr . David Alan Gilbert" , "Matthew Wilcox (Oracle)" , Vlastimil Babka , Baolin Wang , Miaohe Lin , Yang Shi , Frank van der Linden , Jiaqi Yan , linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 17, 2023 at 4:28 PM James Houghton wrote: > > This is a simple change: don't create a "huge" PTE if we are making a > regular, PAGE_SIZE PTE. All architectures that want to implement HGM > likely need to be changed in a similar way if they implement their own > version of arch_make_huge_pte. > > Signed-off-by: James Houghton > > diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h > index 726d581158b1..b767b6889dea 100644 > --- a/include/linux/hugetlb.h > +++ b/include/linux/hugetlb.h > @@ -899,7 +899,7 @@ static inline void arch_clear_hugepage_flags(struct page *page) { } > static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, > vm_flags_t flags) > { > - return pte_mkhuge(entry); > + return shift > PAGE_SHIFT ? pte_mkhuge(entry) : entry; > } > #endif > How are contig_pte's handled here? Will shift show that it's actually a contig_pte and not just PAGE_SHIFT? Or is that arm64 specific so it exists only in the arm64 version of this function? Do we need to worry about it here? > -- > 2.39.2.637.g21b0678d19-goog >