Re: [PATCH] fork: dup_mm: init vm stat counters under mmap_sem
From: Oleg Nesterov
Date: Wed Jun 18 2014 - 11:23:21 EST
On 06/18, Vladimir Davydov wrote:
>
> @@ -365,7 +365,12 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
> */
> down_write_nested(&mm->mmap_sem, SINGLE_DEPTH_NESTING);
>
> + mm->total_vm = oldmm->total_vm;
> mm->locked_vm = 0;
> + mm->pinned_vm = 0;
> + mm->shared_vm = oldmm->shared_vm;
> + mm->exec_vm = oldmm->exec_vm;
> + mm->stack_vm = oldmm->stack_vm;
> mm->mmap = NULL;
> mm->vmacache_seqnum = 0;
> mm->map_count = 0;
I think the patch is fine.
But perhaps this deserves more cleanups, with or without this patch
the initialization does not look consistent. dup_mmap() nullifies
locked_vm/pinned_vm/mmap/map_count while mm_init() clears core_state/
nr_ptes/rss_stat.
Oleg.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/