Message ID | 20221021163703.3218176-15-jthoughton@google.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 0CD18FA3740 for <linux-mm@archiver.kernel.org>; Fri, 21 Oct 2022 16:37:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7E99C8E0011; Fri, 21 Oct 2022 12:37:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6856D8E0001; Fri, 21 Oct 2022 12:37:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3F0E98E0011; Fri, 21 Oct 2022 12:37:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 170938E0001 for <linux-mm@kvack.org>; Fri, 21 Oct 2022 12:37:31 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id B93D7406AE for <linux-mm@kvack.org>; Fri, 21 Oct 2022 16:37:30 +0000 (UTC) X-FDA: 80045512260.16.E587D4C Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) by imf29.hostedemail.com (Postfix) with ESMTP id 56B43120018 for <linux-mm@kvack.org>; Fri, 21 Oct 2022 16:37:30 +0000 (UTC) Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-360a7ff46c3so34032277b3.12 for <linux-mm@kvack.org>; Fri, 21 Oct 2022 09:37:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=vfmRA2hXHJo+o02NNvf+xyYOK4fmmGYkyLRnRI2e0ew=; b=N0Njss2tbbufEOGB3mWef6ZPPCsGQk8p/qgNHuo+xubJr8V06BeblG2+fHSKMDlxA/ UJHivxWkHImjyXzOSjLEeYcZId2JJN2s+UU8otxIgWTW9duZ5h63B+TLoNO25kQvzWXU HeD3Hvh1l9z43C29huY50us4lyvu6ehOMFBsaP/qsg6yn2ieehrftiopv/q8ZpHCLJ3Y K7UMsTw8/CtFVq/Ds71EirrkPGmvM7a28uKqnCDpCM+PSuE49qWj9kjs6TX0wErVJMdC fBYvTwS4YdM1mYbSThmJwyUIU5RPiBM8YE1g/uw7dhpETOePIsSy4CEuuJN9RhbaqsIy 0rtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vfmRA2hXHJo+o02NNvf+xyYOK4fmmGYkyLRnRI2e0ew=; b=CA8pUfsubWFZfVXioBmr+/SEGktCttkbZbjUZVUQOUztUb//aAZKoWF7AReoMhP7bZ 1czNuuCJss+8P/sWgaxJK1Xgqior8CLa/usw0uS6Av7Uxpz8hrpxRs/ME7kJcxSrJ22K I1YzI2xHzohNbN0GquBax9STDueYs91f0UWs6k/oSclq3eu34CdLpOLE8kY6s7F9FKTP gw/UFcpOHHZ45+YZSxzxuKta4SkQMrOHHN+MchZMdAyZRf3PwDmFeaNmQ2RYNAks3/DV 2NkuGwbFWHjwo7/PTGarkpvpzynlXHm5lbCO9c3/D5bpyavE94SxuLLxfSDwve4HVnlX aQEA== X-Gm-Message-State: ACrzQf30eMffE+/N1KR6ruyyFLq5LCI7kqxgg2C5rdO8Q1Z6pWE4yuWy WPhnCZ7oQDNxSo6Ne0NJEQPcMw1O0radTt2p X-Google-Smtp-Source: AMsMyM75iODIU2u9+2Ko6JMPySQIphDFX4W2ca1ATqg4hjaMgjVtf9dtnIOEwBdlJcFpQluhwu54PMNKNN8Zpw+u X-Received: from jthoughton.c.googlers.com ([fda3:e722:ac3:cc00:14:4d90:c0a8:2a4f]) (user=jthoughton job=sendgmr) by 2002:a25:ca8d:0:b0:6c1:99ab:5798 with SMTP id a135-20020a25ca8d000000b006c199ab5798mr17535543ybg.19.1666370249622; Fri, 21 Oct 2022 09:37:29 -0700 (PDT) Date: Fri, 21 Oct 2022 16:36:30 +0000 In-Reply-To: <20221021163703.3218176-1-jthoughton@google.com> Mime-Version: 1.0 References: <20221021163703.3218176-1-jthoughton@google.com> X-Mailer: git-send-email 2.38.0.135.g90850a2211-goog Message-ID: <20221021163703.3218176-15-jthoughton@google.com> Subject: [RFC PATCH v2 14/47] hugetlb: make default arch_make_huge_pte understand small mappings From: James Houghton <jthoughton@google.com> To: Mike Kravetz <mike.kravetz@oracle.com>, Muchun Song <songmuchun@bytedance.com>, Peter Xu <peterx@redhat.com> Cc: David Hildenbrand <david@redhat.com>, David Rientjes <rientjes@google.com>, Axel Rasmussen <axelrasmussen@google.com>, Mina Almasry <almasrymina@google.com>, "Zach O'Keefe" <zokeefe@google.com>, Manish Mishra <manish.mishra@nutanix.com>, Naoya Horiguchi <naoya.horiguchi@nec.com>, "Dr . David Alan Gilbert" <dgilbert@redhat.com>, "Matthew Wilcox (Oracle)" <willy@infradead.org>, Vlastimil Babka <vbabka@suse.cz>, Baolin Wang <baolin.wang@linux.alibaba.com>, Miaohe Lin <linmiaohe@huawei.com>, Yang Shi <shy828301@gmail.com>, Andrew Morton <akpm@linux-foundation.org>, linux-mm@kvack.org, linux-kernel@vger.kernel.org, James Houghton <jthoughton@google.com> Content-Type: text/plain; charset="UTF-8" ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=N0Njss2t; spf=pass (imf29.hostedemail.com: domain of 3ycpSYwoKCMoz9x4Awx943w44w1u.s421y3AD-220Bqs0.47w@flex--jthoughton.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3ycpSYwoKCMoz9x4Awx943w44w1u.s421y3AD-220Bqs0.47w@flex--jthoughton.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666370250; a=rsa-sha256; cv=none; b=mGy3Ef3nCVo/0zpscW2jCjDnDt+PdAj52z6p3/r3qhe8uNiz+bCYYNaZsdJBg3NB4zzvdR VTw9LOoDrKlAmcvjcHRvr01lCwXG4rdC3MVlgbK/23Vijtgtiq2H5HcaeJp4y+0fqNB3G2 7bj1RO2Rat/YU3OUyntJ1HQpRSZWMbM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666370250; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=vfmRA2hXHJo+o02NNvf+xyYOK4fmmGYkyLRnRI2e0ew=; b=XZcq+iaam4FRwQBUS4smUtPV4DXIYAiO/ZRBdncElvogdsWngSb1AxFcApaAZnky36NvG5 IgJypMsepdtA7VH/yqXImvbjd/8aPdhomD8kXXNj/1mxIh3VK8z0mGLTX8fQXlSNTEYj1A YaPQfVMT3q2W68idlWP5mpAc6SovJjs= Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=N0Njss2t; spf=pass (imf29.hostedemail.com: domain of 3ycpSYwoKCMoz9x4Awx943w44w1u.s421y3AD-220Bqs0.47w@flex--jthoughton.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3ycpSYwoKCMoz9x4Awx943w44w1u.s421y3AD-220Bqs0.47w@flex--jthoughton.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com X-Stat-Signature: orqyte98hge4sfxdhfpc6c365fpd1tq3 X-Rspamd-Queue-Id: 56B43120018 X-Rspamd-Server: rspam02 X-Rspam-User: X-HE-Tag: 1666370250-378562 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: <linux-mm.kvack.org> |
Series |
hugetlb: introduce HugeTLB high-granularity mapping
|
expand
|
On 10/21/22 16:36, 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. Nothing wrong with this patch. However, I wish there was some way we could flag this requirement in arch specific code. Just seems like something that would be easy to overlook.
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 4b1548adecde..d305742e9d44 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -907,7 +907,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
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 <jthoughton@google.com> --- include/linux/hugetlb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)