Linux-man Archive on lore.kernel.org
 help / color / Atom feed
From: Mike Christie <mchristi@redhat.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-api@vger.kernel.org, david@fromorbit.com, mhocko@suse.com,
	masato.suzuki@wdc.com, damien.lemoal@wdc.com, bvanassche@acm.org,
	mtk.manpages@gmail.com, linux-man@vger.kernel.org
Subject: Re: [PATCH 1/1] prctl.2: doc PR_SET/GET_IO_FLUSHER
Date: Thu, 13 Feb 2020 14:14:49 -0600
Message-ID: <5E45AE39.2050509@redhat.com> (raw)
In-Reply-To: <20200213200832.GU6874@magnolia>

On 02/13/2020 02:08 PM, Darrick J. Wong wrote:
> On Thu, Feb 13, 2020 at 12:23:36PM -0600, Mike Christie wrote:
>> This patch documents the PR_SET_IO_FLUSHER and PR_GET_IO_FLUSHER
>> prctl commands added to the linux kernel for 5.6 in commit:
>>
>> commit 8d19f1c8e1937baf74e1962aae9f90fa3aeab463
>> Author: Mike Christie <mchristi@redhat.com>
>> Date:   Mon Nov 11 18:19:00 2019 -0600
>>
>>     prctl: PR_{G,S}ET_IO_FLUSHER to support controlling memory reclaim
>>
>> Signed-off-by: Mike Christie <mchristi@redhat.com>
>> Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
>> ---
>>
>> V3:
>> - Replace emulation device example.
>>
>> V2:
>> - My initial patch for this was very bad. This version is almost 100%
>> taken word for word from Dave Chinner's review comments.
>>
>> Signed-off-by: Mike Christie <mchristi@redhat.com>
>> ---
>>  man2/prctl.2 | 25 +++++++++++++++++++++++++
>>  1 file changed, 25 insertions(+)
>>
>> diff --git a/man2/prctl.2 b/man2/prctl.2
>> index 720ec04e4..58d77bf2e 100644
>> --- a/man2/prctl.2
>> +++ b/man2/prctl.2
>> @@ -1381,6 +1381,30 @@ system call on Tru64).
>>  for information on versions and architectures.)
>>  Return unaligned access control bits, in the location pointed to by
>>  .IR "(unsigned int\ *) arg2" .
>> +.TP
>> +.B PR_SET_IO_FLUSHER (Since Linux 5.6)
>> +An IO_FLUSHER is a user process that the kernel uses to issue IO
>> +that cleans dirty page cache data and/or filesystem metadata. The
>> +kernel may need to clean this memory when under memory pressure in
>> +order to free it. This means there is potential for a memory reclaim
>> +recursion deadlock if the user process attempts to allocate memory
>> +and the kernel then blocks waiting for it to clean memory before it
>> +can make reclaim progress.
>> +
>> +The kernel avoids these recursion problems internally via a special
>> +process state that prevents recursive reclaim from issuing new IO.
>> +If \fIarg2\fP is 1, the \fPPR_SET_IO_FLUSHER\fP control allows a userspace
>> +process to set up this same process state and hence avoid the memory
>> +reclaim recursion deadlocks in the same manner the kernel avoids them.
>> +If \fIarg2\fP is 0, the process will clear the IO_FLUSHER state, and the
>> +default behavior will be used.
> 
> I forget, does a program have to have special capabilities (e.g.
> CAP_SYS_ADMIN) to be able to PR_SET_IO_FLUSHER?

Yes, CAP_SYS_RESOURCE. I will add that info.


> 
> --D
> 
>> +Examples of IO_FLUSHER applications are FUSE daemons, SCSI device
>> +emulation daemons, etc."
>> +.TP
>> +.B PR_GET_IO_FLUSHER (Since Linux 5.6)
>> +Return as the function result 1 if the caller is in the IO_FLUSHER state and
>> +0 if not.
>>  .SH RETURN VALUE
>>  On success,
>>  .BR PR_GET_DUMPABLE ,
>> @@ -1395,6 +1419,7 @@ On success,
>>  .BR PR_GET_SPECULATION_CTRL ,
>>  .BR PR_MCE_KILL_GET ,
>>  .BR PR_CAP_AMBIENT + PR_CAP_AMBIENT_IS_SET ,
>> +.BR PR_GET_IO_FLUSHER ,
>>  and (if it returns)
>>  .BR PR_GET_SECCOMP
>>  return the nonnegative values described above.
>> -- 
>> 2.21.0
>>
> 


  reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-13 18:23 Mike Christie
2020-02-13 20:08 ` Darrick J. Wong
2020-02-13 20:14   ` Mike Christie [this message]
2020-02-14 12:54 ` Michal Hocko
     [not found] <20200210221557.8021-1-mchristi@redhat.com>
2020-02-11 14:17 ` Christian Brauner

Reply instructions:

You may reply publically 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=5E45AE39.2050509@redhat.com \
    --to=mchristi@redhat.com \
    --cc=bvanassche@acm.org \
    --cc=damien.lemoal@wdc.com \
    --cc=darrick.wong@oracle.com \
    --cc=david@fromorbit.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=masato.suzuki@wdc.com \
    --cc=mhocko@suse.com \
    --cc=mtk.manpages@gmail.com \
    /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

Linux-man Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-man/0 linux-man/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-man linux-man/ https://lore.kernel.org/linux-man \
		linux-man@vger.kernel.org
	public-inbox-index linux-man

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-man


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git