Bug 2059644 - request for memory usage warning when setting up dm-writecache
Summary: request for memory usage warning when setting up dm-writecache
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: lvm2
Version: 9.0
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: David Teigland
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks: 2095490 2095492
TreeView+ depends on / blocked
 
Reported: 2022-03-01 15:50 UTC by John Pittman
Modified: 2022-11-15 13:16 UTC (History)
10 users (show)

Fixed In Version: lvm2-2.03.16-1.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2095490 2095492 (view as bug list)
Environment:
Last Closed: 2022-11-15 11:20:43 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker CLUSTERQE-5769 0 None None None 2022-06-08 13:02:54 UTC
Red Hat Issue Tracker RHELPLAN-114134 0 None None None 2022-03-01 15:55:20 UTC
Red Hat Knowledge Base (Solution) 6771021 0 None None None 2022-03-01 19:09:06 UTC
Red Hat Product Errata RHBA-2022:8358 0 None None None 2022-11-15 11:21:24 UTC

Description John Pittman 2022-03-01 15:50:43 UTC
Description of problem:

When larger dm-writecache devices are created, memory usage may be excessive and unexpected.  Requesting some calculation at lvcreate time to say "warning, this will take up x memory, if you have less than y total memory, you may need to think about adding additional ram".  This is just a suggestion, other warning ideas may be better.

Also requesting the presence of the large memory footprint be added to the lvm documentation.

Version-Release number of selected component (if applicable):

lvm2-2.03.12-10.el8.

How reproducible:

Every time

Steps to Reproduce:

Create large dm-writecache device.  Observe memory use.

Actual results:

Large memory use.

Expected results:

If large memory use is expected, there should be a warning at lvcreate and also a mention in the documentation.

Comment 1 David Teigland 2022-03-01 17:45:24 UTC
(Moving this to RHEL9 as a new feature which can then be backported to RHEL8.)

This same thing was requested by Corey in bug 1855038 (which was autoclosed.)

When setting up writecache, if the cachevol size is > 50% of main memory, I'll have it print:
WARNING: writecache will use X GiB of system memory (Y GiB).

And if the cachevol size is > 90% of memory, I'll follow this warning with a confirmation prompt:
Continue to use writecache? [y/n]


I've already added the following to lvmcache(7) man page:

   dm-writecache memory usage
       The amount of main system memory used by dm-writecache can be a factor
       when selecting the writecache cachevol size and the writecache block
       size.

       • writecache block size 4096: each 100 GiB of writecache cachevol uses
         slighly over 2 GiB of system memory.

       • writecache block size 512: each 100 GiB of writecache cachevol uses a
         little over 16 GiB of system memory.

Comment 2 David Teigland 2022-03-02 17:55:51 UTC
man page update:
https://sourceware.org/git/?p=lvm2.git;a=commit;h=6144dac897728a4857294d70645df8ed7a5ff11f
lvconvert warning:
https://sourceware.org/git/?p=lvm2.git;a=commit;h=bef1363c0064f42e8063571143a428ad163d1bd9

# lvconvert --type writecache --cachevol fast2 test/main
Erase all existing data on test/fast2? [y/n]: y
  WARNING: writecache size 400.00 GiB will use 8 GiB of system memory (15 GiB).
  Logical volume test/main now has writecache.

# lvconvert --type writecache --cachevol fast2 test/main
Erase all existing data on test/fast2? [y/n]: y
  WARNING: writecache size 700.00 GiB will use 15 GiB of system memory (15 GiB).
Continue adding writecache? [y/n]: n
  Conversion aborted.

Comment 8 Corey Marthaler 2022-07-15 02:18:44 UTC
Marking Verified:Tested in the latest rpms.

# RHEL9.1 

kernel-5.14.0-127.el9    BUILT: Sat Jul  9 06:54:36 AM CDT 2022
lvm2-2.03.16-2.el9    BUILT: Thu Jul 14 11:45:18 AM CDT 2022
lvm2-libs-2.03.16-2.el9    BUILT: Thu Jul 14 11:45:18 AM CDT 2022

   dm-writecache memory usage
       The amount of main system memory used by dm-writecache can be a factor when selecting the writecache cachevol size and the writecache block size.

       ⢠writecache block size 4096: each 100 GiB of writecache cachevol uses slighly over 2 GiB of system memory.

       ⢠writecache block size 512: each 100 GiB of writecache cachevol uses a little over 16 GiB of system memory.


[root@hayes-03 ~]# lvs -a -o +devices
  LV    VG         Attr       LSize Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert Devices
  wc_lv vdo_sanity -wi-a----- 2.00t                                                     /dev/sdi1(142467)
  wc_lv vdo_sanity -wi-a----- 2.00t                                                     /dev/sde1(0)
  wc_lv vdo_sanity -wi-a----- 2.00t                                                     /dev/sdd1(0)
  write vdo_sanity -wi------- 6.00t                                                     /dev/sdf1(0)
  write vdo_sanity -wi------- 6.00t                                                     /dev/sdg1(0)
  write vdo_sanity -wi------- 6.00t                                                     /dev/sdh1(0)    
  write vdo_sanity -wi------- 6.00t                                                     /dev/sdi1(0)

[root@hayes-03 ~]# lvconvert --yes --type writecache --cachevol vdo_sanity/write vdo_sanity/wc_lv
  Using writecache block size 4096 for unknown file system block size, logical block size 512, physical block size 4096.
  WARNING: unable to detect a file system block size on vdo_sanity/wc_lv
  WARNING: using a writecache block size larger than the file system block size may corrupt the file system.
  WARNING: writecache size 6.00 TiB will use 132 GiB of system memory (251 GiB).
  Logical volume vdo_sanity/wc_lv now has writecache.

Comment 13 errata-xmlrpc 2022-11-15 11:20:43 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (lvm2 bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:8358


Note You need to log in before you can comment on or make changes to this bug.