mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>
To: Anna-Maria Behnsen <anna-maria@linutronix.de>,
	 Frederic Weisbecker <frederic@kernel.org>,
	 Andy Lutomirski <luto@kernel.org>,
	 Vincenzo Frascino <vincenzo.frascino@arm.com>,
	 Thomas Gleixner <tglx@kernel.org>
Cc: "Nam Cao" <namcao@linutronix.de>,
	"Sebastian Andrzej Siewior" <bigeasy@linutronix.de>,
	linux-kernel@vger.kernel.org,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"David Hildenbrand" <david@kernel.org>,
	"Jason Gunthorpe" <jgg@ziepe.ca>,
	"John Hubbard" <jhubbard@nvidia.com>,
	"Peter Xu" <peterx@redhat.com>,
	linux-mm@kvack.org, "Lorenzo Stoakes" <ljs@kernel.org>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	"Vlastimil Babka" <vbabka@kernel.org>,
	"Mike Rapoport" <rppt@kernel.org>,
	"Suren Baghdasaryan" <surenb@google.com>,
	"Michal Hocko" <mhocko@suse.com>,
	"Thomas Weißschuh" <thomas.weissschuh@linutronix.de>
Subject: [PATCH v3 6/6] vdso/datastore: Simplify the mapping logic for VDSO_TIME_PAGE_OFFSET
Date: Mon, 18 May 2026 11:49:44 +0200	[thread overview]
Message-ID: <20260518-vdso-mlockall-v3-6-bf4f2af2b41f@linutronix.de> (raw)
In-Reply-To: <20260518-vdso-mlockall-v3-0-bf4f2af2b41f@linutronix.de>

The logic for CONFIG_GENERIC_GETTIMEOFDAY=n and !timens_page is
identical now.

Use this to simplify the logic a bit.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
---
 lib/vdso/datastore.c | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/lib/vdso/datastore.c b/lib/vdso/datastore.c
index 3f837cb6a886..21f09fa5e254 100644
--- a/lib/vdso/datastore.c
+++ b/lib/vdso/datastore.c
@@ -76,22 +76,20 @@ static vm_fault_t vvar_fault(const struct vm_special_mapping *sm,
 
 	switch (vmf->pgoff) {
 	case VDSO_TIME_PAGE_OFFSET:
-		if (!IS_ENABLED(CONFIG_GENERIC_GETTIMEOFDAY))
+		if (!IS_ENABLED(CONFIG_GENERIC_GETTIMEOFDAY) || !timens_page)
 			break;
-		if (timens_page) {
-			/*
-			 * Fault in VVAR page too, since it will be accessed
-			 * to get clock data anyway.
-			 */
-			unsigned long addr;
-			vm_fault_t err;
-
-			addr = vmf->address + VDSO_TIMENS_PAGE_OFFSET * PAGE_SIZE;
-			err = vmf_insert_page(vma, addr, page);
-			if (unlikely(err & VM_FAULT_ERROR))
-				return err;
-			page = timens_page;
-		}
+		/*
+		 * Fault in VVAR page too, since it will be accessed
+		 * to get clock data anyway.
+		 */
+		unsigned long addr;
+		vm_fault_t err;
+
+		addr = vmf->address + VDSO_TIMENS_PAGE_OFFSET * PAGE_SIZE;
+		err = vmf_insert_page(vma, addr, page);
+		if (unlikely(err & VM_FAULT_ERROR))
+			return err;
+		page = timens_page;
 		break;
 	case VDSO_TIMENS_PAGE_OFFSET:
 		/*

-- 
2.53.0


  parent reply	other threads:[~2026-05-18  9:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-18  9:49 [PATCH v3 0/6] vdso/datastore: Allow prefaulting by mlockall() Thomas Weißschuh
2026-05-18  9:49 ` [PATCH v3 1/6] vdso/datastore: Rename data pages variable Thomas Weißschuh
2026-05-18  9:49 ` [PATCH v3 2/6] vdso/datastore: Map pages in terms of the faults pgoff Thomas Weißschuh
2026-05-18  9:49 ` [PATCH v3 3/6] vdso/datastore: Map zeroed pages for unavailable data Thomas Weißschuh
2026-05-18  9:49 ` [PATCH v3 4/6] vdso/datastore: Explicitly prevent remote access to timens vvar page Thomas Weißschuh
2026-05-18  9:49 ` [PATCH v3 5/6] vdso/datastore: Allow prefaulting by mlockall() Thomas Weißschuh
2026-05-18  9:49 ` Thomas Weißschuh [this message]
2026-06-02 18:41 ` [PATCH v3 0/6] " David Hildenbrand (Arm)
2026-06-03 10:10   ` Thomas Weißschuh
2026-06-03 11:35     ` David Hildenbrand (Arm)
2026-06-03 12:47       ` Thomas Weißschuh
2026-06-03 12:57         ` David Hildenbrand (Arm)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260518-vdso-mlockall-v3-6-bf4f2af2b41f@linutronix.de \
    --to=thomas.weissschuh@linutronix.de \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=anna-maria@linutronix.de \
    --cc=bigeasy@linutronix.de \
    --cc=david@kernel.org \
    --cc=frederic@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=jhubbard@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=luto@kernel.org \
    --cc=mhocko@suse.com \
    --cc=namcao@linutronix.de \
    --cc=peterx@redhat.com \
    --cc=rppt@kernel.org \
    --cc=surenb@google.com \
    --cc=tglx@kernel.org \
    --cc=vbabka@kernel.org \
    --cc=vincenzo.frascino@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®