diff options
author | Dave Hansen <dave.hansen@linux.intel.com> | 2014-07-31 11:41:01 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2014-07-31 11:48:51 -0400 |
commit | 2d040a1ce903ca5d6e7c983621fb29c6883c4c48 (patch) | |
tree | 2969f9de20422d8e247cf6e13d043330878baff6 /arch/x86/mm | |
parent | d17d8f9dedb9dd76fd540a5c497101529d9eb25a (diff) |
x86/mm: New tunable for single vs full TLB flush
Most of the logic here is in the documentation file. Please take
a look at it.
I know we've come full-circle here back to a tunable, but this
new one is *WAY* simpler. I challenge anyone to describe in one
sentence how the old one worked. Here's the way the new one
works:
If we are flushing more pages than the ceiling, we use
the full flush, otherwise we use per-page flushes.
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Link: http://lkml.kernel.org/r/20140731154101.12B52CAF@viggo.jf.intel.com
Acked-by: Rik van Riel <riel@redhat.com>
Acked-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/mm')
-rw-r--r-- | arch/x86/mm/tlb.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c index 6f00ecb9feeb..cb7caddf0902 100644 --- a/arch/x86/mm/tlb.c +++ b/arch/x86/mm/tlb.c | |||
@@ -265,3 +265,49 @@ void flush_tlb_kernel_range(unsigned long start, unsigned long end) | |||
265 | on_each_cpu(do_kernel_range_flush, &info, 1); | 265 | on_each_cpu(do_kernel_range_flush, &info, 1); |
266 | } | 266 | } |
267 | } | 267 | } |
268 | |||
269 | static ssize_t tlbflush_read_file(struct file *file, char __user *user_buf, | ||
270 | size_t count, loff_t *ppos) | ||
271 | { | ||
272 | char buf[32]; | ||
273 | unsigned int len; | ||
274 | |||
275 | len = sprintf(buf, "%ld\n", tlb_single_page_flush_ceiling); | ||
276 | return simple_read_from_buffer(user_buf, count, ppos, buf, len); | ||
277 | } | ||
278 | |||
279 | static ssize_t tlbflush_write_file(struct file *file, | ||
280 | const char __user *user_buf, size_t count, loff_t *ppos) | ||
281 | { | ||
282 | char buf[32]; | ||
283 | ssize_t len; | ||
284 | int ceiling; | ||
285 | |||
286 | len = min(count, sizeof(buf) - 1); | ||
287 | if (copy_from_user(buf, user_buf, len)) | ||
288 | return -EFAULT; | ||
289 | |||
290 | buf[len] = '\0'; | ||
291 | if (kstrtoint(buf, 0, &ceiling)) | ||
292 | return -EINVAL; | ||
293 | |||
294 | if (ceiling < 0) | ||
295 | return -EINVAL; | ||
296 | |||
297 | tlb_single_page_flush_ceiling = ceiling; | ||
298 | return count; | ||
299 | } | ||
300 | |||
301 | static const struct file_operations fops_tlbflush = { | ||
302 | .read = tlbflush_read_file, | ||
303 | .write = tlbflush_write_file, | ||
304 | .llseek = default_llseek, | ||
305 | }; | ||
306 | |||
307 | static int __init create_tlb_single_page_flush_ceiling(void) | ||
308 | { | ||
309 | debugfs_create_file("tlb_single_page_flush_ceiling", S_IRUSR | S_IWUSR, | ||
310 | arch_debugfs_dir, NULL, &fops_tlbflush); | ||
311 | return 0; | ||
312 | } | ||
313 | late_initcall(create_tlb_single_page_flush_ceiling); | ||