Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

erofs: kill use_vmap module parameter

As Christoph said [1],
"vm_map_ram is supposed to generally behave better. So if
it doesn't please report that that to the arch maintainer
and linux-mm so that they can look into the issue. Having
user make choices of deep down kernel internals is just
a horrible interface.

Please talk to maintainers of other bits of the kernel
if you see issues and / or need enhancements. "

Let's redo the previous conclusion and kill the vmap
approach.

[1] https://lore.kernel.org/r/20190830165533.GA10909@infradead.org/
Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Link: https://lore.kernel.org/r/20190904020912.63925-21-gaoxiang25@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Gao Xiang and committed by
Greg Kroah-Hartman
73d03931 e2c71e74

+13 -37
-4
Documentation/filesystems/erofs.txt
··· 67 67 It still does in-place I/O decompression 68 68 for the rest compressed physical clusters. 69 69 70 - Module parameters 71 - ================= 72 - use_vmap=[0|1] Use vmap() instead of vm_map_ram() (default 0). 73 - 74 70 On-disk details 75 71 =============== 76 72
+13 -33
fs/erofs/decompressor.c
··· 28 28 char *name; 29 29 }; 30 30 31 - static bool use_vmap; 32 - module_param(use_vmap, bool, 0444); 33 - MODULE_PARM_DESC(use_vmap, "Use vmap() instead of vm_map_ram() (default 0)"); 34 - 35 31 static int z_erofs_lz4_prepare_destpages(struct z_erofs_decompress_req *rq, 36 32 struct list_head *pagepool) 37 33 { ··· 217 221 } 218 222 } 219 223 220 - static void *erofs_vmap(struct page **pages, unsigned int count) 221 - { 222 - int i = 0; 223 - 224 - if (use_vmap) 225 - return vmap(pages, count, VM_MAP, PAGE_KERNEL); 226 - 227 - while (1) { 228 - void *addr = vm_map_ram(pages, count, -1, PAGE_KERNEL); 229 - 230 - /* retry two more times (totally 3 times) */ 231 - if (addr || ++i >= 3) 232 - return addr; 233 - vm_unmap_aliases(); 234 - } 235 - return NULL; 236 - } 237 - 238 - static void erofs_vunmap(const void *mem, unsigned int count) 239 - { 240 - if (!use_vmap) 241 - vm_unmap_ram(mem, count); 242 - else 243 - vunmap(mem); 244 - } 245 - 246 224 static int z_erofs_decompress_generic(struct z_erofs_decompress_req *rq, 247 225 struct list_head *pagepool) 248 226 { ··· 225 255 const struct z_erofs_decompressor *alg = decompressors + rq->alg; 226 256 unsigned int dst_maptype; 227 257 void *dst; 228 - int ret; 258 + int ret, i; 229 259 230 260 if (nrpages_out == 1 && !rq->inplace_io) { 231 261 DBG_BUGON(!*rq->out); ··· 263 293 goto dstmap_out; 264 294 } 265 295 266 - dst = erofs_vmap(rq->out, nrpages_out); 296 + i = 0; 297 + while (1) { 298 + dst = vm_map_ram(rq->out, nrpages_out, -1, PAGE_KERNEL); 299 + 300 + /* retry two more times (totally 3 times) */ 301 + if (dst || ++i >= 3) 302 + break; 303 + vm_unmap_aliases(); 304 + } 305 + 267 306 if (!dst) 268 307 return -ENOMEM; 308 + 269 309 dst_maptype = 2; 270 310 271 311 dstmap_out: ··· 284 304 if (!dst_maptype) 285 305 kunmap_atomic(dst); 286 306 else if (dst_maptype == 2) 287 - erofs_vunmap(dst, nrpages_out); 307 + vm_unmap_ram(dst, nrpages_out); 288 308 return ret; 289 309 } 290 310