Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2545628ybl; Thu, 9 Jan 2020 14:51:27 -0800 (PST) X-Google-Smtp-Source: APXvYqyRrcQ01w324r5n9Qas/4YrlCdqw7bKAlXCGQ8UNAY9gepz/sw8ZP7Ld+JyAHdMPTkJILFl X-Received: by 2002:aca:b7c5:: with SMTP id h188mr5194072oif.100.1578610286943; Thu, 09 Jan 2020 14:51:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578610286; cv=none; d=google.com; s=arc-20160816; b=xGh9j/lLdHxqiCi/GlT4M6cZDEIpLBGhQyv6rRwhx51GX7u4zr915RjY6ImnVRTErx IH608rqTmFahgbDFpcoE+4m6V0oLikipXmNsDUg39czf2MJklEYP53McKhO9a5RaDuM+ /9dcCGeCB/lrYY0U0vdmmNp0NMB8t8RcRLEnJHxe9fYQ6OV25v8Ot3f70C4zLU43Cm7I 9rpYN6v+dMwFYVuQ78UhlzTFtUKPMnG7mKIVlyD+9GYi792zRlWEp8cOmnDI3QBUCrH4 awMFGIUo6g1mBx+/rtX5nTB23BvUruoF7ELI9YAG16wtMGDAE2WOqR9fgUMU1ccfRyLb Q5Zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=k7ISzqbE/KZZt3XwTbX/udqflcCaugIF6aqfyQZAke0=; b=GeA3OelxISEiIzilEuTv4jfdUKUNC2H9nDbiHx31GxxP81BaUhBg3ySHYrvBqkBGGs bAJseaen5+fpvqF6c9TySFibTKbX9bs5Jnykbes8d+hLIrL/3f3nX5cc0JGMfghD1+fk 1pygzU0AmjDNzsvvXw4nNFLl6VUOv2m1X6X4KBrQvBddU37r3lctXztqOZOt08SJwqlB uJ8f0PV+w1cHz1KpmjaS+a7zaqQX1INmpGTwjVemZorcM+J7dtdHJXxATvJjp3mR0kM8 YpcwDuCF2gpjk/DagurQo1n6gPI2NwxvIxqV4QgNoHpWDnC/+jxIbBUoWWXaSoXMp7tb AAfQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m85si4189941oig.158.2020.01.09.14.51.10; Thu, 09 Jan 2020 14:51:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729618AbgAIWsu (ORCPT + 99 others); Thu, 9 Jan 2020 17:48:50 -0500 Received: from jabberwock.ucw.cz ([46.255.230.98]:51378 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729570AbgAIWss (ORCPT ); Thu, 9 Jan 2020 17:48:48 -0500 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 70FE11C25BD; Thu, 9 Jan 2020 23:48:47 +0100 (CET) Date: Thu, 9 Jan 2020 23:48:45 +0100 From: Pavel Machek To: Michal Hocko Cc: kernel list , Andrew Morton , linux-mm@kvack.org, akpm@linux-foundation.org Subject: Re: OOM killer not nearly agressive enough? Message-ID: <20200109224845.GA1220@amd> References: <20200107204412.GA29562@amd> <20200109115633.GR4951@dhcp22.suse.cz> <20200109210307.GA1553@duo.ucw.cz> <20200109212516.GA23620@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="k+w/mQv8wyuph6w0" Content-Disposition: inline In-Reply-To: <20200109212516.GA23620@dhcp22.suse.cz> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --k+w/mQv8wyuph6w0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > > > > Do we agree that OOM killer should have reacted way sooner? > > >=20 > > > This is impossible to answer without knowing what was going on at the > > > time. Was the system threshing over page cache/swap? In other words, = is > > > the system completely out of memory or refaulting the working set all > > > the time because it doesn't fit into memory? > >=20 > > Swap was full, so "completely out of memory", I guess. Chromium does > > that fairly often :-(. >=20 > The oom heuristic is based on the reclaim failure. If the reclaim makes > some progress then the oom killer is not hit. Have a look at > should_reclaim_retry for more details. Thanks for pointer. I guess setting MAX_RECLAIM_RETRIES to 1 is not something you'd recommend? :-). > > PSI is completely different system, but I guess > > I should attempt to tweak the existing one first... >=20 > PSI is measuring the cost of the allocation (among other things) and > that can give you some idea on how much time is spent to get memory. > Userspace can implement a policy based on that and act. The kernel oom > killer is the last resort when there is really no memory to > allocate. So what I'm seeing is system that is unresponsive, easily for an hour. Sometimes, I'm able to log in. When I could do that, system was absurdly slow, like ps printing at more than 10 seconds per line. ps on my system takes 300msec, estimate in the slow case would be 2000 seconds, that is slowdown by factor of 6000x. That would be X terminal opening in like two hours... that's not really usable. DRAM is in 100nsec range, disk is in 10msec range; so worst case slowdown is somewhere in 100000x range. (Actually, in the worst case userland will do no progress at all, since you can need at 4+ pages in single CPU instruction, right?) But kernel is happy; system is unusable and will stay unusable for hour or more, and there's not much user can do. (Besides sysrq, thanks for the hint). Can we do better? This is equivalent of system crash, and it is _way_ too easy to trigger. Should we do better by default? Dunno. If user moved the mouse, and cursor did not move for 10 seconds, perhaps it is time for oom kill? Or should I add more swap? Is it terrible to place swap on SSD? Best regards, Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --k+w/mQv8wyuph6w0 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAl4Xrc0ACgkQMOfwapXb+vLMPQCgmBZmHNndoxFTIC/1s3EKXFzj wk0AmgNweQm6peBeROBvZwII5FaQJw2C =mB1/ -----END PGP SIGNATURE----- --k+w/mQv8wyuph6w0--