Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1058264ybl; Tue, 13 Aug 2019 06:49:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqwXW2sNgJVmFvIBjXcv5z2fff+tCSKVAW3lpbQpRhWKUpwjw3pweF4w6AA1RdkjeqB59w0t X-Received: by 2002:aa7:91cc:: with SMTP id z12mr41066467pfa.76.1565704140075; Tue, 13 Aug 2019 06:49:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565704140; cv=none; d=google.com; s=arc-20160816; b=lue4VdRXg1eQLUwUsF2yhTYKRKR7k6gxM0r/qpvN7cyfI1WF3EPvXdVa2Ck3FKCcKJ r0kWfJxKJTWoGqpn9VknIkhLZpPj0Z7vZgoMTe67a9wLDWzh6RhD49dkZGE+keiYXY/V lDlmP8/ZkR146+qC31qZ5UQ72+Uzn9aS7LjEhYGmBjfG62lgMAbmlrQOlLB0vWnMlfgc eN4f8r5pGlTD2tP8cBbgRjqYza5OHAN3bHcLU2fbz+F+HYMCKTztWQh11V+8NRUawkus VBxo5LakaHY0nz0roMSMLgh1TTG3X0d8GJ8tRAgvO/bevHRkqvQ906Ni6vnkIiIywlyI jCqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject; bh=7AnO5b0wVgtO1yukyxJ+bJXiYAp66HMeuvafkaRbFoA=; b=FRXwmcPJWzLnSqMA3Bwtxomy4MBztx38VMpVTeyedXkhwCkl2urxpqoeIPu2O+zjcg I2FSghCRpuMbPSfhyDUMRlZMA0bw4vhbTLlNCFkyjgh0m8BcrkGspfGEIsuiuRtcot8Q kplc053R3QbbYyyKZFJp0Vd2zcmoMoK7U3Y7Y0zWwFcrc+wBgPN/Ylwy7Rto6aP7qFlo Q6WOsCArxh4vw7mJyTiWWYW+a5MCmTZUgKgJvRY5lJctK2oCLs8laSOPwMmAz1XyB9Mc kfou29IV/erQUi1fnA65KMTzw5za652/d655r/XP/PWl4hhDnYjEDsuduyHaQ4212B6S WChw== 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 o15si6275226pll.20.2019.08.13.06.48.43; Tue, 13 Aug 2019 06:49:00 -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; 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 S1729294AbfHMNrr (ORCPT + 99 others); Tue, 13 Aug 2019 09:47:47 -0400 Received: from mx2.suse.de ([195.135.220.15]:59906 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729141AbfHMNrr (ORCPT ); Tue, 13 Aug 2019 09:47:47 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 91DE7ADDC; Tue, 13 Aug 2019 13:47:45 +0000 (UTC) Subject: Re: Let's talk about the elephant in the room - the Linux kernel's inability to gracefully handle low memory pressure To: Johannes Weiner Cc: Michal Hocko , Suren Baghdasaryan , "Artem S. Tashkinov" , Andrew Morton , LKML , linux-mm References: <398f31f3-0353-da0c-fc54-643687bb4774@suse.cz> <20190806142728.GA12107@cmpxchg.org> <20190806143608.GE11812@dhcp22.suse.cz> <20190806220150.GA22516@cmpxchg.org> <20190807075927.GO11812@dhcp22.suse.cz> <20190807205138.GA24222@cmpxchg.org> <20190808172725.GA16900@cmpxchg.org> <6e7f0cd2-8b13-7534-1c0e-f3569f8b4c05@suse.cz> <20190809173108.GA21089@cmpxchg.org> From: Vlastimil Babka Openpgp: preference=signencrypt Autocrypt: addr=vbabka@suse.cz; prefer-encrypt=mutual; keydata= mQINBFZdmxYBEADsw/SiUSjB0dM+vSh95UkgcHjzEVBlby/Fg+g42O7LAEkCYXi/vvq31JTB KxRWDHX0R2tgpFDXHnzZcQywawu8eSq0LxzxFNYMvtB7sV1pxYwej2qx9B75qW2plBs+7+YB 87tMFA+u+L4Z5xAzIimfLD5EKC56kJ1CsXlM8S/LHcmdD9Ctkn3trYDNnat0eoAcfPIP2OZ+ 9oe9IF/R28zmh0ifLXyJQQz5ofdj4bPf8ecEW0rhcqHfTD8k4yK0xxt3xW+6Exqp9n9bydiy tcSAw/TahjW6yrA+6JhSBv1v2tIm+itQc073zjSX8OFL51qQVzRFr7H2UQG33lw2QrvHRXqD Ot7ViKam7v0Ho9wEWiQOOZlHItOOXFphWb2yq3nzrKe45oWoSgkxKb97MVsQ+q2SYjJRBBH4 8qKhphADYxkIP6yut/eaj9ImvRUZZRi0DTc8xfnvHGTjKbJzC2xpFcY0DQbZzuwsIZ8OPJCc LM4S7mT25NE5kUTG/TKQCk922vRdGVMoLA7dIQrgXnRXtyT61sg8PG4wcfOnuWf8577aXP1x 6mzw3/jh3F+oSBHb/GcLC7mvWreJifUL2gEdssGfXhGWBo6zLS3qhgtwjay0Jl+kza1lo+Cv BB2T79D4WGdDuVa4eOrQ02TxqGN7G0Biz5ZLRSFzQSQwLn8fbwARAQABtCBWbGFzdGltaWwg QmFia2EgPHZiYWJrYUBzdXNlLmN6PokCVAQTAQoAPgIbAwULCQgHAwUVCgkICwUWAgMBAAIe AQIXgBYhBKlA1DSZLC6OmRA9UCJPp+fMgqZkBQJcbbyGBQkH8VTqAAoJECJPp+fMgqZkpGoP /1jhVihakxw1d67kFhPgjWrbzaeAYOJu7Oi79D8BL8Vr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q8lq8vJOxv6XD6xcTtj5Az8t2JjdUX6SF9hxJpwhBU0wrCoGDkWp4Bbv6jnF7zP Nzftr4l8RuJoywDIiJpdaNpSlXKpj/K6KrnyAI/joYc7 Message-ID: <71773a98-803f-7731-e47c-d51cf262bbf7@suse.cz> Date: Tue, 13 Aug 2019 15:47:44 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190809173108.GA21089@cmpxchg.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/9/19 7:31 PM, Johannes Weiner wrote: >> It made a difference, but not enough, it seems. Before the patch I could >> observe "io:full avg10" around 75% and "memory:full avg10" around 20%, >> after the patch, "memory:full avg10" went to around 45%, while io stayed >> the same (BTW should the refaults be discounted from the io counters, so >> that the sum is still <=100%?) >> >> As a result I could change the knobs to recover successfully with >> thrashing detected for 10s of 40% memory pressure. >> >> Perhaps being low on memory we can't detect refaults so well due to >> limited number of shadow entries, or there was genuine non-refault I/O >> in the mix. The detection would then probably have to look at both I/O >> and memory? > > Thanks for testing it. It's possible that there is legitimate > non-refault IO, and there can be interaction of course between that > and the refault IO. But to be sure that all genuine refaults are > captured, can you record the workingset_* values from /proc/vmstat > before/after the thrash storm? In particular, workingset_nodereclaim > would indicate whether we are losing refault information. Let's see... after a ~45 second stall that I ended up by alt-sysrq-f, I see the following pressure info: cpu:some avg10=1.04 avg60=2.22 avg300=2.01 total=147402828 io:some avg10=97.13 avg60=65.48 avg300=28.86 total=240442256 io:full avg10=83.93 avg60=57.05 avg300=24.56 total=212125506 memory:some avg10=54.62 avg60=33.69 avg300=15.89 total=67989547 memory:full avg10=44.48 avg60=28.17 avg300=13.17 total=55963961 Captured vmstat workingset values before: workingset_nodes 15756 workingset_refault 6111959 workingset_activate 1805063 workingset_restore 919138 workingset_nodereclaim 40796 pgpgin 33889644 after: workingset_nodes 14842 workingset_refault 9248248 workingset_activate 1966317 workingset_restore 961179 workingset_nodereclaim 41060 pgpgin 46488352 Doesn't seem like losing too much refault info, and it's indeed a mix of refaults and other I/O? (difference is 3M for refaults and 12.5M for pgpgin). > [ The different resource pressures are not meant to be summed > up. Refaults truly are both IO events and memory events: they > indicate memory contention, but they also contribute to the IO > load. So both metrics need to include them, or it would skew the > picture when you only look at one of them. ] Understood, makes sense.