linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Memory mapped pages not being swapped out
@ 2018-06-05 19:14 Rafael Telles
  2018-06-06 12:43 ` Michal Hocko
  0 siblings, 1 reply; 4+ messages in thread
From: Rafael Telles @ 2018-06-05 19:14 UTC (permalink / raw)
  To: linux-mm

[-- Attachment #1: Type: text/plain, Size: 1004 bytes --]

Hi there, I am running a program where I need to map hundreds of thousands
of files and each file has several kilobytes (min. of 4kb per file). The
program calls mmap() for every 4096 bytes on each file, ending up with
millions of memory mapped pages, so I have ceil(N/4096) pages for each
file, where N is the file size.

As the program runs, more files are created and the older files get bigger,
then I need to remap those pages, so it's always adding more pages.

I am concerned about when and how Linux is going to swap out pages in order
to get more memory, the program seems to only increase memory usage overall
and I am afraid it runs out of memory.

I tried setting these sysctl parameters so it would swap out as soon as
possible (just to understand how Linux memory management works), but it
didn't change anything:

vm.zone_reclaim_mode = 1
vm.min_unmapped_ratio = 99


How can I be sure the program won't run out of memory? Do I have to
manually unmap pages to free memory?

Thanks so much

[-- Attachment #2: Type: text/html, Size: 1832 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-06-06 13:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-05 19:14 Memory mapped pages not being swapped out Rafael Telles
2018-06-06 12:43 ` Michal Hocko
2018-06-06 13:28   ` Rafael Telles
2018-06-06 13:35     ` Michal Hocko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox