RE: [RFC] USB: gadget: f_mass_storage: limit page cache usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

On Friday, January 28, 2011 4:31 PM Alan Stern wrote:

> On Fri, 28 Jan 2011, Marek Szyprowski wrote:
> 
> > This commit add code that flushed page cache disk buffers every 128 read
> > and write request. It has almost no impact on the performance of the
> > emulate usb drive but saves system page cache from being filled with
> > useless emulated disk data.
> >
> > Signed-off-by: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx>
> > Signed-off-by: Kyungmin Park <kyungmin.park@xxxxxxxxxxx>
> >
> > ---
> >
> > Hello,
> >
> > In the embedded system development we encoutered a really anoying
> > behaviour of USB mass storage gadget. We use it to export SD card as USB
> > disk. However when user copies a lot of data from or to the USB disk,
> > the mass storage gadget consumes almost all pages from system page
> > cache. This results in a significant degradation of system and io
> > performance. A lot of valid and really often used disk cache data is
> > wiped from memory and need to be constantly reloaded.
> >
> > Caching mass storage backing file is usually useless. Host system very
> > rarely sends requests for the same blocks in the limited time window.
> > Usually there is another caching layer on the host system anyway.
> >
> > Disabling page cache for the backing file is also not the solution,
> > because mmc perform really bad on direct 512 byte reads and writes.
> >
> > I've did a quick hack to limit the amount of page cache that is being
> > used by mass storage gadget.  I've forced mass storage gadget to flush
> > and invalidate page cache once every 128 read or write request. I know
> > that the patch is ugly but it solves the issue.
> 
> Can you post an equivalent patch for file_storage.c?  The same issues
> apply there.

Right. I wonder if my approach is really correct. Flushing every 128th
request seems to be really hacky. I would really like to find a better
way to decide when to flush/invalidate the page cache.

I will post a patch for file_storage.c on Monday, now I need to go out
from the office.

> > Do you have any suggestion how to correctly introduce a method of
> > limiting page cache usage in the mass storage gadget?
> 
> How do other storage or filesystem servers do it (e.g., NFS, CIFS)?

I will investigate how this is handled there. Thanks for the comments.

Best regards
--
Marek Szyprowski
Samsung Poland R&D Center

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux