[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190910232808.zqlvgnuym6emvdyf@box.shutemov.name>
Date: Wed, 11 Sep 2019 02:28:08 +0300
From: "Kirill A. Shutemov" <kirill@...temov.name>
To: Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
Cc: Mike Christie <mchristi@...hat.com>, axboe@...nel.dk,
James.Bottomley@...senPartnership.com, martin.petersen@...cle.com,
linux-kernel@...r.kernel.org, linux-scsi@...r.kernel.org,
linux-block@...r.kernel.org, Linux-MM <linux-mm@...ck.org>
Subject: Re: [RFC PATCH] Add proc interface to set PF_MEMALLOC flags
On Wed, Sep 11, 2019 at 07:12:06AM +0900, Tetsuo Handa wrote:
> >> +static ssize_t memalloc_write(struct file *file, const char __user *buf,
> >> + size_t count, loff_t *ppos)
> >> +{
> >> + struct task_struct *task;
> >> + char buffer[5];
> >> + int rc = count;
> >> +
> >> + memset(buffer, 0, sizeof(buffer));
> >> + if (count != sizeof(buffer) - 1)
> >> + return -EINVAL;
> >> +
> >> + if (copy_from_user(buffer, buf, count))
>
> copy_from_user() / copy_to_user() might involve memory allocation
> via page fault which has to be done under the mask? Moreover, since
> just open()ing this file can involve memory allocation, do we forbid
> open("/proc/thread-self/memalloc") ?
Not saying that I'm okay with the approach in general, but I don't think
this a problem. The application has to set allocation policy before
inserting itself into IO or FS path.
--
Kirill A. Shutemov
Powered by blists - more mailing lists