mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2 V3] Allow access to sysfs attributes without mem allocations.
@ 2014-10-13  5:41 NeilBrown
  2014-10-13  5:41 ` [PATCH 2/2] sysfs/kernfs: make read requests on pre-alloc files use the buffer NeilBrown
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: NeilBrown @ 2014-10-13  5:41 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Tejun Heo, linux-kernel, Al Viro

Hi Greg,
 please consider these two patches for a future release.
 They now have
   Reviewed-by: Tejun Heo <tj@kernel.org>
 and I've addressed Tejun's final nits.

 Thanks Tejun for your review and comments.

 As soon as they appear in an -rc1, I'll submit updates to md to use
 the new functionality for the -rc2.

Thanks,
NeilBrown


---

NeilBrown (2):
      sysfs/kernfs: allow attributes to request write buffer be pre-allocated.
      sysfs/kernfs: make read requests on pre-alloc files use the buffer.


 fs/kernfs/file.c       |   73 +++++++++++++++++++++++++++++++++---------------
 fs/sysfs/file.c        |   57 ++++++++++++++++++++++++++++++++-----
 include/linux/kernfs.h |    8 +++++
 include/linux/sysfs.h  |    9 ++++++
 4 files changed, 116 insertions(+), 31 deletions(-)

-- 
Signature


^ permalink raw reply	[flat|nested] 10+ messages in thread
* [PATCH 0/2 V2] Allow access to sysfs attributes without mem allocations.
@ 2014-10-08 23:57 NeilBrown
  2014-10-08 23:57 ` [PATCH 2/2] sysfs/kernfs: make read requests on pre-alloc files use the buffer NeilBrown
  0 siblings, 1 reply; 10+ messages in thread
From: NeilBrown @ 2014-10-08 23:57 UTC (permalink / raw)
  To: Tejun Heo, Greg Kroah-Hartman; +Cc: linux-kernel, Al Viro

Hi Tejun,
 thanks for the review.  This version incorporates your suggestions.

 You are certainly right about there being issues deeper than just the
 sysfs/kernfs level - I've been cleaning up the locking in md to avoid
 the "reconfig_mutex" as much as possible.  It is something that has
 been at the back of my mind for a while, but this need has pushed it
 to the fore-front.  All the attributes that mdmon needs to touch will
 soon only take a spinlock or nothing.

 On the topic of inadvertently locking in semantics, I noticed that
 prior to kernfs, sysfs would allocate a buffer on first read or
 write, and continue to use that buffer.  I could try to argue that I
 was using those semantics, which have now changed ... though I wasn't
 doing it consciously...  Certainly this is a thorny issue.

 As well as checking that ->seq_show isn't used with ->prealloc,
 I've also made sure that sysfs_kf_read() doesn't call the attribute
 ->show() function unless it is certain it has a preallocated (and
 hence >= PAGE_SIZE) buffer.

Thanks,
NeilBrown

---

NeilBrown (2):
      sysfs/kernfs: allow attributes to request write buffer be pre-allocated.
      sysfs/kernfs: make read requests on pre-alloc files use the buffer.


 fs/kernfs/file.c       |   70 ++++++++++++++++++++++++++++++++----------------
 fs/sysfs/file.c        |   53 +++++++++++++++++++++++++++++++-----
 include/linux/kernfs.h |    2 +
 include/linux/sysfs.h  |    9 ++++++
 4 files changed, 103 insertions(+), 31 deletions(-)

-- 
Signature


^ permalink raw reply	[flat|nested] 10+ messages in thread
* [PATCH 0/2] Allow access to sysfs attributes without mem allocations.
@ 2014-09-30  2:33 NeilBrown
  2014-09-30  2:33 ` [PATCH 2/2] sysfs/kernfs: make read requests on pre-alloc files use the buffer NeilBrown
  0 siblings, 1 reply; 10+ messages in thread
From: NeilBrown @ 2014-09-30  2:33 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Greg Kroah-Hartman, linux-kernel, Al Viro

Hi Tejun,
 is this closer to what you would like?

 I do really need this functionality, but I honestly don't like this
 patch.
 The need to identify just which attributes need special care seems
 backwards to me.
  1/ it is the process (which has called mlock etc) which needs
     special care, more than the attribute.  Everything that process
     does needs to avoid allocating memory, whether that this is
     particularly related to enabling write-out or not.
  2/ It is also backwards because the vast majority of sysfs
     attributes only support bool/enum/int which means at most
     23 chars including sign and newline (maybe more for reads if the
     read provides a list of options).  So almost everything
     doesn't need an allocation at all - just some on-stack space.
     I would be quite happy to identify those attributes that
     may need care when accessing and could possibly supports
     read or write > 128 characters, because there wouldn't be any.

  I also don't like this approach because we end up allocating 2 pages
  for the buffer, as we have to ask for "PAGE_SIZE+1" bytes, for the
  hypothetical case that an important attribute actually requires a
  full PAGE_SIZE write...

  Would you be happy to have all specially identified attributes be
  limited to 127 characters IO max?  Then I would just use an on-stack
  buffer for those which would remove the allocation and simplify some
  of the code.

Thanks,
NeilBrown

---

NeilBrown (2):
      sysfs - allow attributes to request write buffer be pre-allocated.
      sysfs/kernfs: make read requests on pre-alloc files use the buffer.


 fs/kernfs/file.c       |   52 +++++++++++++++++++++++++++++++----------------
 fs/sysfs/file.c        |   53 +++++++++++++++++++++++++++++++++++++++++-------
 include/linux/kernfs.h |    2 ++
 include/linux/sysfs.h  |    9 ++++++++
 4 files changed, 90 insertions(+), 26 deletions(-)

-- 
Signature


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-10-14  5:57 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-13  5:41 [PATCH 0/2 V3] Allow access to sysfs attributes without mem allocations NeilBrown
2014-10-13  5:41 ` [PATCH 2/2] sysfs/kernfs: make read requests on pre-alloc files use the buffer NeilBrown
2014-10-14  5:57   ` [PATCH 2/2 - revised] " NeilBrown
2014-10-13  5:41 ` [PATCH 1/2] sysfs/kernfs: allow attributes to request write buffer be pre-allocated NeilBrown
2014-10-13  8:35 ` [PATCH 0/2 V3] Allow access to sysfs attributes without mem allocations Greg Kroah-Hartman
2014-10-13 10:21   ` NeilBrown
  -- strict thread matches above, loose matches on Subject: below --
2014-10-08 23:57 [PATCH 0/2 V2] " NeilBrown
2014-10-08 23:57 ` [PATCH 2/2] sysfs/kernfs: make read requests on pre-alloc files use the buffer NeilBrown
2014-10-09 13:52   ` Tejun Heo
2014-09-30  2:33 [PATCH 0/2] Allow access to sysfs attributes without mem allocations NeilBrown
2014-09-30  2:33 ` [PATCH 2/2] sysfs/kernfs: make read requests on pre-alloc files use the buffer NeilBrown
2014-10-05 20:02   ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®