staging: lustre: mdc: excessive memory consumption by the xattr cache
authorAndrew Perepechko <c17827@cray.com>
Tue, 29 May 2018 14:21:44 +0000 (10:21 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 31 May 2018 16:55:37 +0000 (18:55 +0200)
commit889cea43c54b91b92011649ce53db4fdc51ed86c
treea76b046aa8bc004f6b4af5a3b2faf9127017c219
parent6f17a0443972fb700dca7f0be882206ae23c27d6
staging: lustre: mdc: excessive memory consumption by the xattr cache

The refill operation of the xattr cache does not know the
reply size in advance, so it makes a guess based on
the maxeasize value returned by the MDS.

In practice, it allocates 16 KiB for the common case and
4 MiB for the large xattr case. However, a typical reply
is just a few hundred bytes.

If we follow the conservative approach, we can prepare a
single memory page for the reply. It is large enough for
any reasonable xattr set and, at the same time, it does
not require multiple page memory reclaim, which can be
costly.

If, for a specific file, the reply is larger than a single
page, the client is prepared to handle that and will fall back
to non-cached xattr code. Indeed, if this happens often and
xattrs are often used to store large values, it makes sense to
disable the xattr cache at all since it wasn't designed for
such [mis]use.

Signed-off-by: Andrew Perepechko <c17827@cray.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9417
Reviewed-on: https://review.whamcloud.com/26887
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Ben Evans <bevans@cray.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/mdc/mdc_locks.c