lkml.org 
[lkml]   [2019]   [Sep]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2019-09-11 01:29    [W:0.048 / U:1.372 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site