Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1163156
| From | Alexey Dobriyan <adobriyan@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v6] procfs: Always expose /proc/<pid>/map_files/ and make it readable |
| Date | 2015-06-11 13:20 +0200 |
| Message-ID | <pA8GC-40B-15@gated-at.bofh.it> (permalink) |
| References | <prGeu-1RF-5@gated-at.bofh.it> <pziI1-2ST-3@gated-at.bofh.it> <pzz6a-1SC-13@gated-at.bofh.it> <pzDjt-7Zy-5@gated-at.bofh.it> <pzVgo-Sd-47@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, Jun 10, 2015 at 11:58 PM, Andrew Morton <akpm@linux-foundation.org> wrote: > On Tue, 9 Jun 2015 18:39:02 -0700 Calvin Owens <calvinowens@fb.com> wrote: > >> On Tuesday 06/09 at 14:13 -0700, Andrew Morton wrote: >> > On Mon, 8 Jun 2015 20:39:33 -0700 Calvin Owens <calvinowens@fb.com> wrote: >> > >> > > Currently, /proc/<pid>/map_files/ is restricted to CAP_SYS_ADMIN, and >> > > is only exposed if CONFIG_CHECKPOINT_RESTORE is set. >> > > >> > > This interface very useful because it allows userspace to stat() >> > > deleted files that are still mapped by some process, which enables a >> > > much quicker and more accurate answer to the question "How much disk >> > > space is being consumed by files that are deleted but still mapped?" >> > > than is currently possible. >> > >> > Why is that information useful? >> > >> > I could perhaps think of some use for "How much disk space is being >> > consumed by files that are deleted but still open", but to count the >> > mmapped-then-unlinked files while excluding the opened-then-unlinked >> > files seems damned peculiar. >> >> Let's phrase the question a bit more generically: >> >> "How much disk space is being consumed by files that have been >> unlinked, but are still referenced by some process?" >> >> There are two pieces to this problem: >> 1) Unlinked files that are still open (whether mapped or not) >> 2) Unlinked files that are not open, but are still mapped >> >> You can track down everything in (1) using /proc/<pid>/fd/*, and you >> can use stat() to figure out how much space they're using. > > This doesn't work if the mapped file has been unlinked? What does the > /proc/pid/map_files listing look like for these? It says "(deleted)" like /proc/*/exe or any other symlink. >> Does that all seem sensible? > > Spose so. Please capture all this info in the changelog. > > > It all seems a bit awkward though. If we want to know "how much disk > space is this process using" (or similar) then I wonder what a syscall > (or prctl mode?) which does this would look like. I believe something like this is needed for checkpointing, otherwise mmaped but unlinked files could not be restored fully (how do you reach them?). -- 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/
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v6] procfs: Always expose /proc/<pid>/map_files/ and make it readable Calvin Owens <calvinowens@fb.com> - 2015-06-09 05:50 +0200
Re: [PATCH v6] procfs: Always expose /proc/<pid>/map_files/ and make it readable Calvin Owens <calvinowens@fb.com> - 2015-06-10 03:50 +0200
Re: [PATCH v6] procfs: Always expose /proc/<pid>/map_files/ and make it readable Alexey Dobriyan <adobriyan@gmail.com> - 2015-06-11 13:20 +0200
csiph-web