lkml.org 
[lkml]   [2014]   [Jul]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Where in the code mmap + MAP_ANONYMOUS clears returned pages?
On Tue 15-07-14 21:55:03, Alexei Fedotov wrote:
> Guys,
>
> I look into mmap.c code [1] and try to understand where anonymous
> memory mapping (mmap + MAP_ANONYMOUS) sets memory to zero. My best
> guess is I should dig that somewhere in mmap_region.
>
> Could you please help me locating the code which makes returned memory
> pages clean? Thank you in advance.

mmap doesn't allocate pages which back the mapping directly unless it is
told to by MAP_POPULATE. So the clean pages are either allocated during
the page fault path when the memory is accessed (see do_anonymous_page
for private 4k pages fault, do_huge_pmd_anonymous_page for THP page and
MAP_SHARED is left as an excercise for the reader ;)) or in mmap path
directly when MAP_POPULATE is specified (see vm_mmap_pgoff which calls
mm_populate)

>
> [1] http://code.ohloh.net/file?fid=RPa2fuiQ5j_IwR1nymptYBBC3X4&cid=w6qrXNDsMqk
>
> --
> With best regards / с наилучшими пожеланиями,
> Alexei Fedotov / Алексей Федотов,
> http://dataved.ru/
> +7 916 562 8095
>
> [1] Start using Apache Openmeetings today, http://openmeetings.apache.org/
> [2] Join Alexei Fedotov @linkedin, http://ru.linkedin.com/in/dataved/
> [3] Join Alexei Fedotov @facebook, http://www.facebook.com/openmeetings
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

--
Michal Hocko
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2014-07-15 22:01    [W:0.043 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site