linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Kawai, Hidehiro" <hidehiro.kawai.ez@hitachi.com>
To: "Kawai, Hidehiro" <hidehiro.kawai.ez@hitachi.com>
Cc: akpm@osdl.org, pavel@suse.cz, linux-kernel@vger.kernel.org,
	dhowells@redhat.com, alan@lxorguk.ukuu.org.uk
Subject: [PATCH 4/4] coredump: documentation for proc and sysctl
Date: Fri, 26 Jan 2007 23:15:50 +0900	[thread overview]
Message-ID: <45BA0D16.8040909@hitachi.com> (raw)
In-Reply-To: <45BA0A93.30004@hitachi.com>

This patch adds the documentation for the following parameters:
  /proc/<pid>/core_flags
  /proc/sys/kernel/core_flags_enable

Signed-off-by: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
---
 Documentation/filesystems/proc.txt |   42 +++++++++++++++++++++++++++
 Documentation/sysctl/kernel.txt    |   11 +++++++
 2 files changed, 53 insertions(+)

Index: linux-2.6.20-rc4-mm1/Documentation/filesystems/proc.txt
===================================================================
--- linux-2.6.20-rc4-mm1.orig/Documentation/filesystems/proc.txt
+++ linux-2.6.20-rc4-mm1/Documentation/filesystems/proc.txt
@@ -41,6 +41,7 @@ Table of Contents
   2.11	/proc/sys/fs/mqueue - POSIX message queues filesystem
   2.12	/proc/<pid>/oom_adj - Adjust the oom-killer score
   2.13	/proc/<pid>/oom_score - Display current oom-killer score
+  2.14	/proc/<pid>/core_flags - Core dump control flags
 
 ------------------------------------------------------------------------------
 Preface
@@ -1981,6 +1982,47 @@ This file can be used to check the curre
 any given <pid>. Use it together with /proc/<pid>/oom_adj to tune which
 process should be killed in an out-of-memory situation.
 
+2.14 /proc/<pid>/core_flags - Core dump control flags
+---------------------------------------------------------------------
+When a process is dumped, all anonymous memory is written to a core file as
+long as the size of the core file isn't limited. But sometimes we don't want
+to dump some memory segments, for example, huge shared memory.
+
+The /proc/<pid>/core_flags file enables you to omit some anonymous memory from
+a core file when it is generated. The content of the proc file is bitmask of
+memory segment types you don't want to dump. When the <pid> process is dumped,
+the core dump routine decides whether a given memory segment should be dumped
+into a core file or not, based on the type of the memory segment and bitmask.
+
+Currently, only valid bit is bit 0. If bit 0 is set, anonymous `shared' memory
+segments are not dumped. There are three types of anonymous shared memory:
+
+  - IPC shared memory
+  - the memory segments created by mmap(2) with MAP_ANONYMOUS and MAP_SHARED
+    flags
+  - the memory segments created by mmap(2) with MAP_SHARED flag, and the
+    mapped file has already been unlinked
+
+Because current core dump routine doesn't distinguish these segments, you can
+only choose either dumping all anonymous shared memory segments or not.
+
+If you don't want to dump all shared memory segments attached to pid 1234, set
+the bit 0 of the process's core_flags to 1:
+
+  $ echo 1 > /proc/1234/core_flags
+
+Additionally, you can check its hexadecimal value by reading the file:
+
+  $ cat /proc/1234/core_flags
+  00000001
+
+When a new process is created, the process inherits the core_flags setting
+from its parent. It is useful to set the core_flags before the program runs.
+For example:
+
+  $ echo 1 > /proc/self/core_flags
+  $ ./some_program
+
 ------------------------------------------------------------------------------
 Summary
 ------------------------------------------------------------------------------
Index: linux-2.6.20-rc4-mm1/Documentation/sysctl/kernel.txt
===================================================================
--- linux-2.6.20-rc4-mm1.orig/Documentation/sysctl/kernel.txt
+++ linux-2.6.20-rc4-mm1/Documentation/sysctl/kernel.txt
@@ -20,6 +20,7 @@ show up in /proc/sys/kernel:
 - acct
 - core_pattern
 - core_uses_pid
+- core_flags_enable
 - ctrl-alt-del
 - dentry-state
 - domainname
@@ -122,6 +123,16 @@ the filename.
 
 ==============================================================
 
+core_flags_enable:
+
+This file enables/disables each flag in /proc/<pid>/core_flags
+(please see Documentation/filesystems/proc.txt). If a bit in
+core_flags_enable is set, the corresponding flag in
+/proc/<pid>/core_flags is effective, otherwise the flag is
+discarded.
+
+==============================================================
+
 ctrl-alt-del:
 
 When the value in this file is 0, ctrl-alt-del is trapped and




  parent reply	other threads:[~2007-01-26 14:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-26 14:05 [PATCH 0/4] coredump: core dump masking support v2 Kawai, Hidehiro
2007-01-26 14:12 ` [PATCH 1/4] coredump: add an interface to specify omitted memory segment types Kawai, Hidehiro
2007-01-26 14:13 ` [PATCH 2/4] coredump: enable to omit anonymous shared memory Kawai, Hidehiro
2007-01-26 14:14 ` [PATCH 3/4] coredump: add a sysctl parameter to disable the core dump omitting feature Kawai, Hidehiro
2007-01-26 16:56   ` Pavel Machek
2007-01-26 14:15 ` Kawai, Hidehiro [this message]
2007-01-26 15:29 ` [PATCH 0/4] coredump: core dump masking support v2 Robin Holt
2007-01-30  7:36   ` Kawai, Hidehiro
2007-01-30 12:44     ` Robin Holt
2007-01-31 12:40       ` Kawai, Hidehiro
2007-02-03 12:48         ` Pavel Machek
2007-02-14 13:26           ` Kawai, Hidehiro
2007-02-14 13:30             ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45BA0D16.8040909@hitachi.com \
    --to=hidehiro.kawai.ez@hitachi.com \
    --cc=akpm@osdl.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).