lkml.org 
[lkml]   [2014]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] kernfs: use stack-buf for small writes.
On Tue, Sep 23, 2014 at 02:06:33PM +1000, NeilBrown wrote:
>
> For a write <= 128 characters, don't use kmalloc.
>
> mdmon, part of mdadm, will sometimes need to write
> to a sysfs file in order to allow writes to the array
> to continue. This is important to support RAID metadata
> types that the kernel doesn't know about.
>
> It is important that this write doesn't block on
> memory allocation. The safest way to ensure that is to
> use an on-stack buffer.

Is it, now? What happens if caller of write(2) loses CPU and gets
the page it's writing from swapped out, just as it's getting to
issuing the actual syscall? copy_from_user() will fault and cause
memory allocation for you...

> Writes are always small, typically less than 10 characters.

Translation: "but my userland code uses it _that_ way; surely, nobody
would do anything else..."


\
 
 \ /
  Last update: 2014-09-24 21:41    [W:0.053 / U:0.220 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site