[lkml]   [2020]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 4/5] mm: shmem: Convert shmem_enabled_show to use sysfs_emit_at
On Mon, Nov 02, 2020 at 02:08:36PM +0000, Matthew Wilcox wrote:
> On Mon, Nov 02, 2020 at 02:33:43PM +0100, Greg Kroah-Hartman wrote:
> > > Oh, ugh, sysfs_emit() should be able to work on a buffer that isn't
> > > page aligned. Greg, how about this?
> >
> > How can sysfs_emit() be called on a non-page-aligned buffer? It's being
> > used on the buffer that was passed to the sysfs call.
> >
> > And if you are writing multiple values to a single sysfs file output,
> > well, not good...
> See shmem_enabled_show() in mm/shmem.c (output at
> /sys/kernel/mm/transparent_hugepage/shmem_enabled on your machine).
> I don't claim it's a good interface, but it exists.

Ok, that's a common pattern for sysfs files, not that bad.

What's wrong with using sysfs_emit_at()? We want sysfs_emit() to "know"
that the buffer is PAGE_SIZE big, if you try to allow offsets in it,
that defeats the purpose of the check.

Or am I missing something else here?


greg k-h

 \ /
  Last update: 2020-11-02 15:33    [W:0.062 / U:0.980 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site