diff options
author | Anton Ivanov <anton.ivanov@cambridgegreys.com> | 2018-11-22 09:45:13 -0500 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2018-12-27 16:48:20 -0500 |
commit | 747b254ca2649d0c206385c7902fb8ac97a2b0b4 (patch) | |
tree | ec37d6dde343cf0e24f9f063adf41e5798c517e1 /arch/um | |
parent | 50109b5a03b4024eb6b8df3ab8f427625f54fe92 (diff) |
um: Remove unnecessary faulted check in uaccess.c
It is not necessary to check if a fault has occured or not
after disabling pagefaults. kmap_atomic does that in all
cases and we can disable it for 64 bit where kmap is not needed
and a simple page_address would suffice.
dd if=/dev/zero of=/dev/null bs=1M count=1M
Before: 3.1GB/s. After: 3.5GB/s
There is a noticeable difference for file disk read and write
as well as less noticeable difference for network IO.
Signed-off-by: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch/um')
-rw-r--r-- | arch/um/kernel/skas/uaccess.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/arch/um/kernel/skas/uaccess.c b/arch/um/kernel/skas/uaccess.c index d450797a3a7c..7f06fdbc7ee1 100644 --- a/arch/um/kernel/skas/uaccess.c +++ b/arch/um/kernel/skas/uaccess.c | |||
@@ -62,27 +62,28 @@ static int do_op_one_page(unsigned long addr, int len, int is_write, | |||
62 | jmp_buf buf; | 62 | jmp_buf buf; |
63 | struct page *page; | 63 | struct page *page; |
64 | pte_t *pte; | 64 | pte_t *pte; |
65 | int n, faulted; | 65 | int n; |
66 | 66 | ||
67 | pte = maybe_map(addr, is_write); | 67 | pte = maybe_map(addr, is_write); |
68 | if (pte == NULL) | 68 | if (pte == NULL) |
69 | return -1; | 69 | return -1; |
70 | 70 | ||
71 | page = pte_page(*pte); | 71 | page = pte_page(*pte); |
72 | #ifdef CONFIG_64BIT | ||
73 | pagefault_disable(); | ||
74 | addr = (unsigned long) page_address(page) + | ||
75 | (addr & ~PAGE_MASK); | ||
76 | #else | ||
72 | addr = (unsigned long) kmap_atomic(page) + | 77 | addr = (unsigned long) kmap_atomic(page) + |
73 | (addr & ~PAGE_MASK); | 78 | (addr & ~PAGE_MASK); |
79 | #endif | ||
80 | n = (*op)(addr, len, arg); | ||
74 | 81 | ||
75 | current->thread.fault_catcher = &buf; | 82 | #ifdef CONFIG_64BIT |
76 | 83 | pagefault_enable(); | |
77 | faulted = UML_SETJMP(&buf); | 84 | #else |
78 | if (faulted == 0) | ||
79 | n = (*op)(addr, len, arg); | ||
80 | else | ||
81 | n = -1; | ||
82 | |||
83 | current->thread.fault_catcher = NULL; | ||
84 | |||
85 | kunmap_atomic((void *)addr); | 85 | kunmap_atomic((void *)addr); |
86 | #endif | ||
86 | 87 | ||
87 | return n; | 88 | return n; |
88 | } | 89 | } |