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.

Merge branch 'akpm' (patches from Andrew)

Merge misc mm fixes from Andrew Morton:
"2 patches.

Subsystems affected by this patch series: mm (userfaultfd and damon)"

* akpm:
mm/damon/dbgfs: fix 'struct pid' leaks in 'dbgfs_target_ids_write()'
userfaultfd/selftests: fix hugetlb area allocations

+17 -8
+7 -2
mm/damon/dbgfs.c
··· 353 353 const char __user *buf, size_t count, loff_t *ppos) 354 354 { 355 355 struct damon_ctx *ctx = file->private_data; 356 + struct damon_target *t, *next_t; 356 357 bool id_is_pid = true; 357 358 char *kbuf, *nrs; 358 359 unsigned long *targets; ··· 398 397 goto unlock_out; 399 398 } 400 399 401 - /* remove targets with previously-set primitive */ 402 - damon_set_targets(ctx, NULL, 0); 400 + /* remove previously set targets */ 401 + damon_for_each_target_safe(t, next_t, ctx) { 402 + if (targetid_is_pid(ctx)) 403 + put_pid((struct pid *)t->id); 404 + damon_destroy_target(t); 405 + } 403 406 404 407 /* Configure the context for the address space type */ 405 408 if (id_is_pid)
+10 -6
tools/testing/selftests/vm/userfaultfd.c
··· 87 87 88 88 static bool map_shared; 89 89 static int shm_fd; 90 - static int huge_fd; 90 + static int huge_fd = -1; /* only used for hugetlb_shared test */ 91 91 static char *huge_fd_off0; 92 92 static unsigned long long *count_verify; 93 93 static int uffd = -1; ··· 223 223 224 224 static void hugetlb_release_pages(char *rel_area) 225 225 { 226 + if (huge_fd == -1) 227 + return; 228 + 226 229 if (fallocate(huge_fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 227 230 rel_area == huge_fd_off0 ? 0 : nr_pages * page_size, 228 231 nr_pages * page_size)) ··· 238 235 char **alloc_area_alias; 239 236 240 237 *alloc_area = mmap(NULL, nr_pages * page_size, PROT_READ | PROT_WRITE, 241 - (map_shared ? MAP_SHARED : MAP_PRIVATE) | 242 - MAP_HUGETLB, 243 - huge_fd, *alloc_area == area_src ? 0 : 244 - nr_pages * page_size); 238 + map_shared ? MAP_SHARED : 239 + MAP_PRIVATE | MAP_HUGETLB | 240 + (*alloc_area == area_src ? 0 : MAP_NORESERVE), 241 + huge_fd, 242 + *alloc_area == area_src ? 0 : nr_pages * page_size); 245 243 if (*alloc_area == MAP_FAILED) 246 244 err("mmap of hugetlbfs file failed"); 247 245 248 246 if (map_shared) { 249 247 area_alias = mmap(NULL, nr_pages * page_size, PROT_READ | PROT_WRITE, 250 - MAP_SHARED | MAP_HUGETLB, 248 + MAP_SHARED, 251 249 huge_fd, *alloc_area == area_src ? 0 : 252 250 nr_pages * page_size); 253 251 if (area_alias == MAP_FAILED)