Re: [PATCH] kernfs: use stack-buf for small writes.

2014-09-24 Thread NeilBrown
On Wed, 24 Sep 2014 20:17:27 +0100 Al Viro wrote: > 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 co

Re: [PATCH] kernfs: use stack-buf for small writes.

2014-09-24 Thread Al Viro
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 t

Re: [PATCH] kernfs: use stack-buf for small writes.

2014-09-22 Thread Tejun Heo
Hello, Neil. On Tue, Sep 23, 2014 at 04:11:44PM +1000, NeilBrown wrote: > You didn't say if you preferred a flag or a 'max_size'. Sorry, missed that. No strong preference but a flag should be easier and enough for now, right? Thanks. -- tejun -- To unsubscribe from this list: send the line "u

Re: [PATCH] kernfs: use stack-buf for small writes.

2014-09-22 Thread NeilBrown
On Tue, 23 Sep 2014 01:51:56 -0400 Tejun Heo wrote: > On Tue, Sep 23, 2014 at 03:40:58PM +1000, NeilBrown wrote: > > > Oh, I meant the buffer seqfile read op writes to, so it depends on the > > > fact that the allocation is only on the first read? That seems > > > extremely brittle to me, especi

Re: [PATCH] kernfs: use stack-buf for small writes.

2014-09-22 Thread Tejun Heo
On Tue, Sep 23, 2014 at 03:40:58PM +1000, NeilBrown wrote: > > Oh, I meant the buffer seqfile read op writes to, so it depends on the > > fact that the allocation is only on the first read? That seems > > extremely brittle to me, especially for an issue which tends to be > > difficult to reproduce

Re: [PATCH] kernfs: use stack-buf for small writes.

2014-09-22 Thread NeilBrown
On Tue, 23 Sep 2014 00:55:49 -0400 Tejun Heo wrote: > Hello, Neil. > > On Tue, Sep 23, 2014 at 02:46:50PM +1000, NeilBrown wrote: > > seqfile is only safe for reads. sysfs via kernfs uses seq_read(), so there > > is only a single allocation on the first read. > > > > It doesn't really related

Re: [PATCH] kernfs: use stack-buf for small writes.

2014-09-22 Thread Tejun Heo
Hello, Neil. On Tue, Sep 23, 2014 at 02:46:50PM +1000, NeilBrown wrote: > seqfile is only safe for reads. sysfs via kernfs uses seq_read(), so there > is only a single allocation on the first read. > > It doesn't really related to fixing writes, except to point out that only > writes need to be

Re: [PATCH] kernfs: use stack-buf for small writes.

2014-09-22 Thread NeilBrown
On Tue, 23 Sep 2014 00:18:17 -0400 Tejun Heo wrote: > On Tue, Sep 23, 2014 at 02:06:33PM +1000, NeilBrown wrote: > ... > > Note that reads from a sysfs file are already safe due to the use for > > seqfile. The first read will allocate a buffer (m->buf) which will > > be used for all subsequent r

Re: [PATCH] kernfs: use stack-buf for small writes.

2014-09-22 Thread Tejun Heo
On Tue, Sep 23, 2014 at 02:06:33PM +1000, NeilBrown wrote: ... > Note that reads from a sysfs file are already safe due to the use for > seqfile. The first read will allocate a buffer (m->buf) which will > be used for all subsequent reads. Hmmm? How is seqfile safe? Where would the seq op write

Re: [PATCH] kernfs: use stack-buf for small writes.

2014-09-22 Thread Tejun Heo
Hello, Neil. On Tue, Sep 23, 2014 at 02:06:33PM +1000, NeilBrown wrote: > When mdmon needs to update metadata after a device failure in an array > there are two 'kmalloc' sources that can trigger deadlock if memory is tight > and needs to be written to the array (which cannot be allowed until m