summaryrefslogtreecommitdiff
path: root/drivers/md/dm-unstripe.c
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2017-08-13 22:45:08 -0400
committerMike Snitzer <snitzer@redhat.com>2018-04-03 15:04:11 -0400
commit5059353df86e2573ccd9d43fd9d9396dcec47ca2 (patch)
treed03c5a937816b5427703a6a74e83b5f11ab43bdb /drivers/md/dm-unstripe.c
parent1eb5fa849f2bf9186a618e85bea23f02e527540a (diff)
dm crypt: limit the number of allocated pages
dm-crypt consumes an excessive amount memory when the user attempts to zero a dm-crypt device with "blkdiscard -z". The command "blkdiscard -z" calls the BLKZEROOUT ioctl, it goes to the function __blkdev_issue_zeroout, __blkdev_issue_zeroout sends a large amount of write bios that contain the zero page as their payload. For each incoming page, dm-crypt allocates another page that holds the encrypted data, so when processing "blkdiscard -z", dm-crypt tries to allocate the amount of memory that is equal to the size of the device. This can trigger OOM killer or cause system crash. Fix this by limiting the amount of memory that dm-crypt allocates to 2% of total system memory. This limit is system-wide and is divided by the number of active dm-crypt devices and each device receives an equal share. Cc: stable@vger.kernel.org Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-unstripe.c')
0 files changed, 0 insertions, 0 deletions