The patch "mm: Send a single IPI to TLB flush multiple pages when unmapping"
would batch 32 pages before sending an IPI. This patch increases the size of
the data structure to hold a pages worth of PFNs before sending an IPI. This
is a trade-off between memory usage and reducing IPIS sent. In the ideal
case where multiple processes are reading large mapped files, this patch
reduces interrupts/second from roughly 180K per second to 60K per second.

Signed-off-by: Mel Gorman <mgor...@suse.de>
---
 include/linux/sched.h | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 9d51841806f4..abff66ecc302 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1275,11 +1275,16 @@ enum perf_event_task_context {
        perf_nr_task_contexts,
 };
 
-/* Matches SWAP_CLUSTER_MAX but refined to limit header dependencies */
-#define BATCH_TLBFLUSH_SIZE 32UL
+/*
+ * Use a page to store as many PFNs as possible for batch unmapping. Adjusting
+ * this trades memory usage for number of IPIs sent
+ */
+#define BATCH_TLBFLUSH_SIZE \
+       ((PAGE_SIZE - sizeof(struct cpumask) - sizeof(unsigned long)) / 
sizeof(unsigned long))
 
 /* Track pages that require TLB flushes */
 struct unmap_batch {
+       /* Update BATCH_TLBFLUSH_SIZE when adjusting this structure */
        struct cpumask cpumask;
        unsigned long nr_pages;
        unsigned long pfns[BATCH_TLBFLUSH_SIZE];
-- 
2.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to