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

Configure Feed

Select the types of activity you want to include in your feed.

aio: don't bother with unmapping when aio_free_ring() is coming from exit_aio()

... since exit_mmap() is coming and it will munmap() everything anyway.
In all other cases aio_free_ring() has ctx->mm == current->mm; moreover,
all other callers of vm_munmap() have mm == current->mm, so this will
allow us to get rid of mm argument of vm_munmap().

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro 936af157 6be5ceb0

+14 -1
+14 -1
fs/aio.c
··· 92 92 for (i=0; i<info->nr_pages; i++) 93 93 put_page(info->ring_pages[i]); 94 94 95 - if (info->mmap_size) 95 + if (info->mmap_size) { 96 + BUG_ON(ctx->mm != current->mm); 96 97 vm_munmap(ctx->mm, info->mmap_base, info->mmap_size); 98 + } 97 99 98 100 if (info->ring_pages && info->ring_pages != info->internal_pages) 99 101 kfree(info->ring_pages); ··· 388 386 "exit_aio:ioctx still alive: %d %d %d\n", 389 387 atomic_read(&ctx->users), ctx->dead, 390 388 ctx->reqs_active); 389 + /* 390 + * We don't need to bother with munmap() here - 391 + * exit_mmap(mm) is coming and it'll unmap everything. 392 + * Since aio_free_ring() uses non-zero ->mmap_size 393 + * as indicator that it needs to unmap the area, 394 + * just set it to 0; aio_free_ring() is the only 395 + * place that uses ->mmap_size, so it's safe. 396 + * That way we get all munmap done to current->mm - 397 + * all other callers have ctx->mm == current->mm. 398 + */ 399 + ctx->ring_info.mmap_size = 0; 391 400 put_ioctx(ctx); 392 401 } 393 402 }