Message ID | 20221021163703.3218176-14-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 D8320FA373D for <linux-mm@archiver.kernel.org>; Fri, 21 Oct 2022 16:37:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5504A8E0010; Fri, 21 Oct 2022 12:37:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4DB358E0001; Fri, 21 Oct 2022 12:37:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 21C548E0010; Fri, 21 Oct 2022 12:37:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 011768E0001 for <linux-mm@kvack.org>; Fri, 21 Oct 2022 12:37:29 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id C554181271 for <linux-mm@kvack.org>; Fri, 21 Oct 2022 16:37:29 +0000 (UTC) X-FDA: 80045512218.25.94B23DC Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) by imf28.hostedemail.com (Postfix) with ESMTP id 680FFC000B for <linux-mm@kvack.org>; Fri, 21 Oct 2022 16:37:29 +0000 (UTC) Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-3697bd55974so33421047b3.15 for <linux-mm@kvack.org>; Fri, 21 Oct 2022 09:37:29 -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=8/NM5zqKrp3T0mJhjHHyOLUnz62gupmqJK/DDFGexZI=; b=kNo3BI9LgJDNbw4zG7f+BcfBeEsxT7zZGWcOge04kuwB3WGs4ua5FnV/ikxacl43mD M6k0xqIMh4xV/kNssOly5E5ouNZTJbE1jiHX8f4BQKdFzjOe8CtoSIjUdke5SPji+pEq kOZ846TjVCKjKeX4b6HxrkfJ6BQ6CGISZePlXZkN2Rm1jtqyKh+RfXYCoD2KqxlK58+X giN/v/U9prCXXWwTgQ+82EXYGKAT/w9/2BGshYZOi4LwaY3LCQutO9qEE+7l1KWb9pbv DCVuuxqs8fuEhlJkR2ekbMYvfUQkoMuOLpKGVnSHPaC+P69I+ARfmCsKOI9PHLE6d5yH SWSQ== 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=8/NM5zqKrp3T0mJhjHHyOLUnz62gupmqJK/DDFGexZI=; b=1zPDQ0LeS/E4pnHZsFBhbvw96mMkKvFBfLhXrRhzWNazzHaJIMtjikoPcYT89n7GLL Znx4yGO+VLHN/xMOtaFG1qzG9nFQJvzIzeoeQDcRWR2GhM1LyQp3lmbxBdsJg2SQ1oZX s0nWnqsMsF/ruFENQPje3KHb/lNOlK3tL9yi3s90a2xBcqcWipe3KsXtYHzVFFjBVhOS /kg/V60W/qXkjnYf4EBfhMLImB8LsGBFxMpL/6q3yQy0ImUCCbid0cUHrE+D3uyTq+TA /r6ozjH9NrPvTsQSRUX2BIOQ+hVStsyQYmhTa6AgzQdle87+ki44+6Y/NGqai2upIrMf jpHw== X-Gm-Message-State: ACrzQf2foJCuXE2NGDMCzovAUxO5CbMfK2ZqNnTPESFKBaXny+Y0nXNI 4f0QHDNgY+OjOyX/4zydgNFpXvodP5BYxk27 X-Google-Smtp-Source: AMsMyM6lUFLmKl2u24xYHvEYAF3HSHyv+Q9NHWaQ4uC8W+BKyVcH1krHI+4kAFLxi7gYBA7W761SZPhq47YrIqjR X-Received: from jthoughton.c.googlers.com ([fda3:e722:ac3:cc00:14:4d90:c0a8:2a4f]) (user=jthoughton job=sendgmr) by 2002:a81:4b96:0:b0:354:8935:d5a9 with SMTP id y144-20020a814b96000000b003548935d5a9mr18239585ywa.36.1666370248722; Fri, 21 Oct 2022 09:37:28 -0700 (PDT) Date: Fri, 21 Oct 2022 16:36:29 +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-14-jthoughton@google.com> Subject: [RFC PATCH v2 13/47] hugetlb: add make_huge_pte_with_shift 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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666370249; a=rsa-sha256; cv=none; b=bps8dX74SNYRvjFhsMAEa9SciOAqaD2BetXgQw6VQJahxTSQzndIWutXPq5OSR5ki7f8fZ v/Ih/8RaP5f2VfGap1aJeUSvlErIw6+FDmc1dfiJV3akALMOAfHEmuR7p+sCY0Vol96JbW wCDXY2Bctjux5TsinZCmls3sc3EdBCg= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=kNo3BI9L; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf28.hostedemail.com: domain of 3yMpSYwoKCMky8w39vw832v33v0t.r310x29C-11zAprz.36v@flex--jthoughton.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3yMpSYwoKCMky8w39vw832v33v0t.r310x29C-11zAprz.36v@flex--jthoughton.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666370249; 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=8/NM5zqKrp3T0mJhjHHyOLUnz62gupmqJK/DDFGexZI=; b=CHLvGEF+KmVQNKJrTGD3ll4/ZxqB7U/brcpQhRhZrLAlqeirc1Ls/IjIhiFocpT+Vnemjh gIg6svZKWzJR4gZpUN5ZdpXIt0EBpq9nqzL0yYxBT+yRx9bT2Dj8GIK3Mlk4hjE3Q2Wmgy ql3Uv+7mmLf96gcfdIgYorRXHbdOJ+o= Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=kNo3BI9L; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf28.hostedemail.com: domain of 3yMpSYwoKCMky8w39vw832v33v0t.r310x29C-11zAprz.36v@flex--jthoughton.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3yMpSYwoKCMky8w39vw832v33v0t.r310x29C-11zAprz.36v@flex--jthoughton.bounces.google.com X-Rspamd-Server: rspam04 X-Rspam-User: X-Stat-Signature: 5w6opzwm68cns393o5c9e64sahao6554 X-Rspamd-Queue-Id: 680FFC000B X-HE-Tag: 1666370249-519263 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 allows us to make huge PTEs at shifts other than the hstate shift, > which will be necessary for high-granularity mappings. > > Signed-off-by: James Houghton <jthoughton@google.com> > --- > mm/hugetlb.c | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) Straight forward, Acked-by: Mike Kravetz <mike.kravetz@oracle.com>
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 90db59632559..74a4afda1a7e 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -4867,11 +4867,11 @@ const struct vm_operations_struct hugetlb_vm_ops = { .pagesize = hugetlb_vm_op_pagesize, }; -static pte_t make_huge_pte(struct vm_area_struct *vma, struct page *page, - int writable) +static pte_t make_huge_pte_with_shift(struct vm_area_struct *vma, + struct page *page, int writable, + int shift) { pte_t entry; - unsigned int shift = huge_page_shift(hstate_vma(vma)); if (writable) { entry = huge_pte_mkwrite(huge_pte_mkdirty(mk_pte(page, @@ -4885,6 +4885,14 @@ static pte_t make_huge_pte(struct vm_area_struct *vma, struct page *page, return entry; } +static pte_t make_huge_pte(struct vm_area_struct *vma, struct page *page, + int writable) +{ + unsigned int shift = huge_page_shift(hstate_vma(vma)); + + return make_huge_pte_with_shift(vma, page, writable, shift); +} + static void set_huge_ptep_writable(struct vm_area_struct *vma, unsigned long address, pte_t *ptep) {
This allows us to make huge PTEs at shifts other than the hstate shift, which will be necessary for high-granularity mappings. Signed-off-by: James Houghton <jthoughton@google.com> --- mm/hugetlb.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)