Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp195070imm; Wed, 22 Aug 2018 02:30:17 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyZjgtpBuMl+D6z5NEFrTh+/qyUDCsVttza4nk3L2GWbRudv0d1hC6A5NMuU1RNVDi2Qw/k X-Received: by 2002:a17:902:6684:: with SMTP id e4-v6mr53389790plk.35.1534930217414; Wed, 22 Aug 2018 02:30:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534930217; cv=none; d=google.com; s=arc-20160816; b=V9QGF0GTavnGGJcml6eGUnd3Kn6qGjjjxj7mWoEW4eChNFHq77eT3qcryeUSDX1Qf5 Zb9AzWZW/Vx78MgEg85slOpzgBwOB0wyvnLDcR2rFHGcc+LIHyvLRgZa4keBElStMNhM 3fEwa/buHb31rom+xEQWuJbilHEl1bq97f3Ge1S9VZVG/3rat4Y4W+txiIcNywbl5e5K 3br8saFdWnYlAU++M4cEGpzaqiSiT1BOxDT7Qk9M2SeMYneHoj7KTBTCMGb4H56h1hSG VvUVNBilYdB7YVnwD+fixhRfzBUTxg7CG9AwtwvX5zLqp9dzLdWf0zUv9yx2MbnbRHzf SsRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:subject:message-id:date:from :mime-version:dkim-signature:arc-authentication-results; bh=LfnPXIVY0w4Vah+h3Qix6eITdiDEsLRcPZ/kAE53N/0=; b=ZinwgFZ6Yh++2+5ZhD4oHhgDQRvFe/YXU2gCmVEMn6S2nufxXyi9DAb7r4eRv5zetR fe5ofI3XnJjQiWQMCWGcMu4wtAdg8k1y4qqyakGACJVJkJOwcs9rGoccouIs601acOIz zALHX0CqQBxRl5F0marFoDwsdFKhFwzVN+Y234x/3NAv/kxm9yGwXVa2x/tFmm7bhy0F MJmHHySck+CL4KJu+5VEOrSADWE4AxHMe2dOuvdS9vDCBukWAguQ+KyDeg3bKD/Uzt9R 7B5AQNHuh7Mls+WmxjK9/EdCYJvurH7A0GEygAnZq7a6F59FTgBFB6aPZzleaRe7GFE7 3Q5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="GG/osBXo"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q65-v6si1289565pga.283.2018.08.22.02.30.02; Wed, 22 Aug 2018 02:30:17 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b="GG/osBXo"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728537AbeHVMxC (ORCPT + 99 others); Wed, 22 Aug 2018 08:53:02 -0400 Received: from mail-vk0-f45.google.com ([209.85.213.45]:35238 "EHLO mail-vk0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728171AbeHVMxC (ORCPT ); Wed, 22 Aug 2018 08:53:02 -0400 Received: by mail-vk0-f45.google.com with SMTP id w193-v6so572538vke.2 for ; Wed, 22 Aug 2018 02:28:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=LfnPXIVY0w4Vah+h3Qix6eITdiDEsLRcPZ/kAE53N/0=; b=GG/osBXovEUOA3/uCiSgARDPt6fsRr2wzimal2+rtyzFCKw6ntIwggO4CK143UMsLE Ht5HU3KeAOE1tlpvWlHts0DH5wcr0JAOnxcL1anHMnEUpYN+ZVdpTdYXCrDRlxX+p/lY nuUJrFuHxh528hct2s5oh6l49Yf/ZzT09KyXwAQ77EQbHcq1XiuCu2lD03JoHpQ9ZRoy 3b9huNdJv+2ML1SSELYtonsTCYvLaezUe4BIGIljINZeSWDsUBQxEW4HlEWla53maF5H ZqgRlT4NxIgVjazrYtxO9ZugBqyfRTuDdLf2kfRslixenY+lI1lCKXReXKuitgn0ab+3 Xesw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=LfnPXIVY0w4Vah+h3Qix6eITdiDEsLRcPZ/kAE53N/0=; b=ceCBKU5SW8ZKICzhscqLeC0ToFOscMABVcdLNuAyY7jzdtPv573+q0xMt5rhEHPGj4 FMrSBPyIp1S+2PpccSwKFY/D8wMmfAtQCYVtRbn0VjOBDIRFLttlkATkpyhLCYBnYRhm tvGOmQOCsNww1Tk4dkI0IP9XoafMKBt+KTLKGxCqN7Ndpgxlru14HsfxN+KBdSXWz0Y8 D5m2wK6FQ1S56EFIRqpgy5P/XS49PVmc4ii9HuLsIMd6LAnwkssDc/8ZUGq//tCtx1GU L7DuA7siQ/1XHSjHPHYQtvJZ6NOF3v/XoNSQKd9TfRldBhJVfZZT+fZdA3hiVigyHA4y inxA== X-Gm-Message-State: APzg51A3VbJ6ApV7h/+ef4XkK5HOW/Eu1VejelOVf0VKHTmTrm6DNe9f 4hdb7UzbWo4fV4e2igUhFgUcuM9h7f37HTwrcrD4KPSDzoI= X-Received: by 2002:a1f:144:: with SMTP id 65-v6mr1032048vkb.13.1534930137268; Wed, 22 Aug 2018 02:28:57 -0700 (PDT) MIME-Version: 1.0 From: Marcus Linsner Date: Wed, 22 Aug 2018 11:25:35 +0200 Message-ID: Subject: Howto prevent kernel from evicting code pages ever? (to avoid disk thrashing when about to run out of RAM) To: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi. How to make the kernel keep(lock?) all code pages in RAM so that kswapd0 won't evict them when the system is under low memory conditions ? The purpose of this is to prevent the kernel from causing lots of disk reads(effectively freezing the whole system) when about to run out of RAM, even when there is no swap enabled, but well before(in real time minutes) OOM-killer triggers to kill the offending process (eg. ld)! I can replicate this consistently with 4G (and 12G) max RAM inside a Qubes OS R4.0 AppVM running Fedora 28 while trying to compile Firefox. The disk thrashing (continuous 192+MiB/sec reads) occurs well before the OOM-killer triggers to kill 'ld' (or 'rustc') process and everything is frozen for (real time) minutes. I've also encountered this on bare metal myself, if it matters at all. I tried to ask this question on SO here: https://stackoverflow.com/q/51927528/10239615 but maybe I have better luck on this mailing list where the kernel experts are. Just think of all the frozen systems that you'll be saving(see related question in the above link, for one), if you figure out the answer to this, whether be it a kernel patch, or some .config options needing change, or whatever. Just consider it, whoever you are, reader :) (probably a kernel god xD 'cause who else would know howto) - I'm actually selfish, I want this for myself, but I'm more than willing to share it with all, once I'm aware of it. (this = this howto: let the OOM-killer kill the offending process asap, without first passing through disk-thrashing hell freezing the OS ;-) er, I mean Hi, and how's life? 'll be even better after you've read this, I guarantee it ;-) just believe! synergize)