From: Barry Song <21cnbao@gmail.com>
To: akpm@linux-foundation.org, linux-mm@kvack.org,
linux-arm-kernel@lists.infradead.org, x86@kernel.org,
catalin.marinas@arm.com, will@kernel.org,
linux-doc@vger.kernel.org
Cc: corbet@lwn.net, arnd@arndb.de, linux-kernel@vger.kernel.org,
darren@os.amperecomputing.com, yangyicong@hisilicon.com,
huzhanyuan@oppo.com, lipeifeng@oppo.com, zhangshiming@oppo.com,
guojian@oppo.com, realmz6@gmail.com,
Barry Song <v-songbaohua@oppo.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
"H. Peter Anvin" <hpa@zytor.com>, Nadav Amit <namit@vmware.com>,
Mel Gorman <mgorman@suse.de>
Subject: [PATCH 3/4] mm: rmap: Extend tlbbatch APIs to fit new platforms
Date: Fri, 8 Jul 2022 00:52:41 +1200 [thread overview]
Message-ID: <20220707125242.425242-4-21cnbao@gmail.com> (raw)
In-Reply-To: <20220707125242.425242-1-21cnbao@gmail.com>
From: Barry Song <v-songbaohua@oppo.com>
Add vma and uaddr to tlbbatch APIs so that platforms like ARM64
are able to apply these two parameters on their specific hard-
ware features. For ARM64, this could be sending tlbi into hard-
ware queues without waiting for its completion.
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Nadav Amit <namit@vmware.com>
Cc: Mel Gorman <mgorman@suse.de>
Signed-off-by: Barry Song <v-songbaohua@oppo.com>
---
arch/x86/include/asm/tlbflush.h | 4 +++-
mm/rmap.c | 12 ++++++++----
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h
index 4af5579c7ef7..9fc48c103b31 100644
--- a/arch/x86/include/asm/tlbflush.h
+++ b/arch/x86/include/asm/tlbflush.h
@@ -251,7 +251,9 @@ static inline u64 inc_mm_tlb_gen(struct mm_struct *mm)
}
static inline void arch_tlbbatch_add_mm(struct arch_tlbflush_unmap_batch *batch,
- struct mm_struct *mm)
+ struct mm_struct *mm,
+ struct vm_area_struct *vma,
+ unsigned long uaddr)
{
inc_mm_tlb_gen(mm);
cpumask_or(&batch->cpumask, &batch->cpumask, mm_cpumask(mm));
diff --git a/mm/rmap.c b/mm/rmap.c
index d320c29a4ad8..2b5b740d0001 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -642,12 +642,14 @@ void try_to_unmap_flush_dirty(void)
#define TLB_FLUSH_BATCH_PENDING_LARGE \
(TLB_FLUSH_BATCH_PENDING_MASK / 2)
-static void set_tlb_ubc_flush_pending(struct mm_struct *mm, bool writable)
+static void set_tlb_ubc_flush_pending(struct mm_struct *mm, bool writable,
+ struct vm_area_struct *vma,
+ unsigned long uaddr)
{
struct tlbflush_unmap_batch *tlb_ubc = ¤t->tlb_ubc;
int batch, nbatch;
- arch_tlbbatch_add_mm(&tlb_ubc->arch, mm);
+ arch_tlbbatch_add_mm(&tlb_ubc->arch, mm, vma, uaddr);
tlb_ubc->flush_required = true;
/*
@@ -737,7 +739,9 @@ void flush_tlb_batched_pending(struct mm_struct *mm)
}
}
#else
-static void set_tlb_ubc_flush_pending(struct mm_struct *mm, bool writable)
+static void set_tlb_ubc_flush_pending(struct mm_struct *mm, bool writable,
+ struct vm_area_struct *vma,
+ unsigned long uaddr)
{
}
@@ -1600,7 +1604,7 @@ static bool try_to_unmap_one(struct folio *folio, struct vm_area_struct *vma,
*/
pteval = ptep_get_and_clear(mm, address, pvmw.pte);
- set_tlb_ubc_flush_pending(mm, pte_dirty(pteval));
+ set_tlb_ubc_flush_pending(mm, pte_dirty(pteval), vma, address);
} else {
pteval = ptep_clear_flush(vma, address, pvmw.pte);
}
--
2.25.1
next prev parent reply other threads:[~2022-07-07 12:53 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-07 12:52 [PATCH 0/4] mm: arm64: bring up BATCHED_UNMAP_TLB_FLUSH Barry Song
2022-07-07 12:52 ` [PATCH 1/4] Revert "Documentation/features: mark BATCHED_UNMAP_TLB_FLUSH doesn't apply to ARM64" Barry Song
2022-07-07 12:52 ` [PATCH 2/4] mm: rmap: Allow platforms without mm_cpumask to defer TLB flush Barry Song
2022-07-08 6:36 ` Nadav Amit
2022-07-08 6:59 ` Barry Song
2022-07-08 8:08 ` Nadav Amit
2022-07-08 8:17 ` Barry Song
2022-07-08 8:27 ` Peter Zijlstra
2022-07-11 0:30 ` Barry Song
2022-07-07 12:52 ` Barry Song [this message]
2022-07-07 16:43 ` [PATCH 3/4] mm: rmap: Extend tlbbatch APIs to fit new platforms Dave Hansen
2022-07-07 21:12 ` Barry Song
2022-07-07 12:52 ` [PATCH 4/4] arm64: support batched/deferred tlb shootdown during page reclamation Barry Song
2022-07-07 13:49 ` Peter Zijlstra
2022-07-07 21:10 ` Barry Song
2022-07-08 6:21 ` Yicong Yang
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=20220707125242.425242-4-21cnbao@gmail.com \
--to=21cnbao@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=bp@alien8.de \
--cc=catalin.marinas@arm.com \
--cc=corbet@lwn.net \
--cc=darren@os.amperecomputing.com \
--cc=dave.hansen@linux.intel.com \
--cc=guojian@oppo.com \
--cc=hpa@zytor.com \
--cc=huzhanyuan@oppo.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lipeifeng@oppo.com \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=namit@vmware.com \
--cc=realmz6@gmail.com \
--cc=tglx@linutronix.de \
--cc=v-songbaohua@oppo.com \
--cc=will@kernel.org \
--cc=x86@kernel.org \
--cc=yangyicong@hisilicon.com \
--cc=zhangshiming@oppo.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;
as well as URLs for NNTP newsgroup(s).