diff options
author | Nick Piggin <npiggin@suse.de> | 2007-10-16 04:25:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 12:42:55 -0400 |
commit | 674b892ede247ef4fb8d00918f02e29c32b9bbaf (patch) | |
tree | 8e170040e64073932ba559cc31f3ec9802337406 /mm | |
parent | 8268f5a7415d914fc855a86aa2284ac819dc6b2e (diff) |
mm: restore KERNEL_DS optimisations
Restore the KERNEL_DS optimisation, especially helpful to the 2copy write
path.
This may be a pretty questionable gain in most cases, especially after the
legacy 2copy write path is removed, but it doesn't cost much.
Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/filemap.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index ec25ba1aef5f..ca04226bf1de 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -2061,7 +2061,7 @@ static ssize_t generic_perform_write_2copy(struct file *file, | |||
2061 | * cannot take a pagefault with the destination page locked. | 2061 | * cannot take a pagefault with the destination page locked. |
2062 | * So pin the source page to copy it. | 2062 | * So pin the source page to copy it. |
2063 | */ | 2063 | */ |
2064 | if (!PageUptodate(page)) { | 2064 | if (!PageUptodate(page) && !segment_eq(get_fs(), KERNEL_DS)) { |
2065 | unlock_page(page); | 2065 | unlock_page(page); |
2066 | 2066 | ||
2067 | src_page = alloc_page(GFP_KERNEL); | 2067 | src_page = alloc_page(GFP_KERNEL); |
@@ -2186,6 +2186,13 @@ static ssize_t generic_perform_write(struct file *file, | |||
2186 | const struct address_space_operations *a_ops = mapping->a_ops; | 2186 | const struct address_space_operations *a_ops = mapping->a_ops; |
2187 | long status = 0; | 2187 | long status = 0; |
2188 | ssize_t written = 0; | 2188 | ssize_t written = 0; |
2189 | unsigned int flags = 0; | ||
2190 | |||
2191 | /* | ||
2192 | * Copies from kernel address space cannot fail (NFSD is a big user). | ||
2193 | */ | ||
2194 | if (segment_eq(get_fs(), KERNEL_DS)) | ||
2195 | flags |= AOP_FLAG_UNINTERRUPTIBLE; | ||
2189 | 2196 | ||
2190 | do { | 2197 | do { |
2191 | struct page *page; | 2198 | struct page *page; |
@@ -2217,7 +2224,7 @@ again: | |||
2217 | break; | 2224 | break; |
2218 | } | 2225 | } |
2219 | 2226 | ||
2220 | status = a_ops->write_begin(file, mapping, pos, bytes, 0, | 2227 | status = a_ops->write_begin(file, mapping, pos, bytes, flags, |
2221 | &page, &fsdata); | 2228 | &page, &fsdata); |
2222 | if (unlikely(status)) | 2229 | if (unlikely(status)) |
2223 | break; | 2230 | break; |