lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240201100835.1626685-1-liushixin2@huawei.com>
Date: Thu, 1 Feb 2024 18:08:33 +0800
From: Liu Shixin <liushixin2@...wei.com>
To: Alexander Viro <viro@...iv.linux.org.uk>, Christian Brauner
	<brauner@...nel.org>, Jan Kara <jack@...e.cz>, Matthew Wilcox
	<willy@...radead.org>, Andrew Morton <akpm@...ux-foundation.org>
CC: <linux-fsdevel@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	<linux-mm@...ck.org>, Liu Shixin <liushixin2@...wei.com>
Subject: [PATCH 0/2] Fix I/O high when memory almost met memcg limit

Recently, when install package in a docker environment where the memory
almost reached the memcg limit, the program have no respond severely for
more than 15 minutes. During this period, the I/O is high(~1G/s) which
cause other programs failed to work properly.

The problem can be constructed in the following way:

 1. Download the image:
	docker pull centos:7
 2. Create a docker with 4G memory limit and 6G memsw limit(cgroupv1):
	docker create --name dockerhub_centos7 --cpu-period=100000
	--cpu-quota=400000 --memory 4G --memory-swap 6G --cap-add=SYS_PTRACE
	--cap-add=SYS_ADMIN --cap-add=NET_ADMIN --cap-add=NET_RAW
	--pids-limit=20000 --ulimit nofile=1048576:1048576
	--ulimit memlock=-1:-1 dockerhub_centos7:latest /usr/sbin/init
 3. Start the docker:
	docker start dockerhub_centos7
 4. Allocate 6094MB memory in docker.
 5. run 'yum install expect'.

We found that this problem is caused by a lot ot meaningless readahead.
Since memory is almost met memcg limit, the readahead page will be
reclaimed immediately and will readahead and reclaim again and again.

These two patch will stop readahead early when memcg charge failed and
will skip readahead when there are too many active refault.

[1] https://lore.kernel.org/linux-mm/c2f4a2fa-3bde-72ce-66f5-db81a373fdbc@huawei.com/T/

Liu Shixin (2):
  mm/readahead: stop readahead loop if memcg charge fails
  mm/readahead: limit sync readahead while too many active refault

 include/linux/fs.h      |  2 ++
 include/linux/pagemap.h |  1 +
 mm/filemap.c            | 16 ++++++++++++++++
 mm/readahead.c          | 12 ++++++++++--
 4 files changed, 29 insertions(+), 2 deletions(-)

-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ