From: Mike Christie <mchristi@redhat.com>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux-scsi@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-block@vger.kernel.org, martin@urbackup.org,
Damien.LeMoal@wdc.com
Subject: Re: [PATCH] Add prctl support for controlling PF_MEMALLOC V2
Date: Tue, 22 Oct 2019 10:42:27 -0500 [thread overview]
Message-ID: <5DAF2363.2070204@redhat.com> (raw)
In-Reply-To: <20191021225234.GC2642@dread.disaster.area>
On 10/21/2019 05:52 PM, Dave Chinner wrote:
> On Mon, Oct 21, 2019 at 04:41:37PM -0500, Mike Christie wrote:
>> There are several storage drivers like dm-multipath, iscsi, tcmu-runner,
>> amd nbd that have userspace components that can run in the IO path. For
>> example, iscsi and nbd's userspace deamons may need to recreate a socket
>> and/or send IO on it, and dm-multipath's daemon multipathd may need to
>> send IO to figure out the state of paths and re-set them up.
>>
>> In the kernel these drivers have access to GFP_NOIO/GFP_NOFS and the
>> memalloc_*_save/restore functions to control the allocation behavior,
>> but for userspace we would end up hitting a allocation that ended up
>> writing data back to the same device we are trying to allocate for.
>
> I think this needs to describe the symptoms this results in. i.e.
> that this can result in deadlocking the IO path.
>
>> This patch allows the userspace deamon to set the PF_MEMALLOC* flags
>> with prctl during their initialization so later allocations cannot
>> calling back into them.
>>
>> Signed-off-by: Mike Christie <mchristi@redhat.com>
>> ---
>
> ....
>> + case PR_SET_MEMALLOC:
>> + if (!capable(CAP_SYS_ADMIN))
>> + return -EPERM;
>
> Wouldn't CAP_SYS_RAWIO (because it's required by kernel IO path
> drivers) or CAP_SYS_RESOURCE (controlling memory allocation
> behaviour) be more appropriate here?
I think I misread a review comment last posting. I will use
CAP_SYS_RESROUCE on the next resend if people do not have any objections.
>
> Which-ever is selected, the use should be added to the list above
> the definition of the capability in include/linux/capability.h...
>
Will do. Thanks.
> Otherwise looks fine to me.
>
> Cheers,
>
> Dave.
>
next prev parent reply other threads:[~2019-10-22 15:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-21 21:41 [PATCH] Add prctl support for controlling PF_MEMALLOC V2 Mike Christie
2019-10-21 22:52 ` Dave Chinner
2019-10-22 15:42 ` Mike Christie [this message]
2019-10-22 11:24 ` Michal Hocko
2019-10-22 16:13 ` Mike Christie
2019-10-22 16:33 ` Michal Hocko
2019-10-22 20:43 ` Dave Chinner
2019-10-23 7:11 ` Michal Hocko
2019-10-23 17:27 ` Mike Christie
2019-10-23 17:35 ` Michal Hocko
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=5DAF2363.2070204@redhat.com \
--to=mchristi@redhat.com \
--cc=Damien.LeMoal@wdc.com \
--cc=david@fromorbit.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin@urbackup.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.