Re: [RFC PATCH] mm: fix mlock incorrent event account

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu 25-05-17 21:48:56, zhong jiang wrote:
> Hi Michal
> 
> by a testcase, The patch is work as I think. The testcase is as follows.
> 
> int main(void)
> {
>     char *map;
>     int fd;
> 
>     fd = open("test", O_CREAT|O_RDWR);
>     unlink("test");
>     ftruncate(fd, 4096);
>     map = mmap(NULL, 4096, PROT_WRITE, MAP_PRIVATE, fd, 0);
>     map[0] = 11;
>     mlock(map, sizeof(fd));

just a nit
you probably wanted mlock(map, 4096)

>     ftruncate(fd, 0);
>     close(fd);
>     munlock(map, sizeof(fd));

similarly here

>     munmap(map, 4096);
> 
>     return 0;
> }
> 
> before:
> unevictable_pgs_mlocked 10589
> unevictable_pgs_munlocked 10588
> unevictable_pgs_cleared 1
> 
> apply the patch;
> after:
> unevictable_pgs_mlocked 9497
> unevictable_pgs_munlocked 9497
> unevictable_pgs_cleared 1

OK, this is definitely useful for the changelog.

> unmap_mapping_range unmap them,  page_remove_rmap will deal with
> clear_page_mlock situation.  we clear page Mlock flag and successful
> isolate the page,  the page will putback the evictable list. but it is not
> record the munlock event.

and this as well. I haven't checked that but it gives reviewers chance
to understand your thinking much better so it is definitely useful.
Mlock code is everything but straightforward.

-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]
  Powered by Linux