Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3823023ybz; Tue, 28 Apr 2020 00:47:22 -0700 (PDT) X-Google-Smtp-Source: APiQypLQsbojlpiDi2QkC/2C/WqHNQltiQAPNvGs2wC5MxW/vTBqq6O6H3JUKTQa84+XUv+jtFDE X-Received: by 2002:a50:9f4a:: with SMTP id b68mr21840682edf.108.1588060041938; Tue, 28 Apr 2020 00:47:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588060041; cv=none; d=google.com; s=arc-20160816; b=ydz4GTVPx5G85UGASA1dEErmUvEgVc1YHVC0/fzWz1UBFMpLh+dDV3KEGFPaTcmIkt VZZB7rupeslONDnarI1PFVRDl3pkRySlvZUROmStR6vbtuK5DJt+jSvL6xaAm3AgVgoY P+AaIerS4yY0JZVm7Z6pOLRksc7FQeOW1lIBollD5H/0lW60LDch7NjuaexbqACwWvlQ 6X/wg3diDD5eMQLrcPoELEKL0fUDWs4gyYWGOQ3IwTZE032YhSlkRdB7QmloTLjzD7t4 p/m0kehnrxL5FG/ytIVYEUzdG7w4Q7NvoqjsARWx+27KQhpQJxJ6PIO/QBBIASgKAQuA 6gnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=4+wiF+sn2LhlnwSYXd62Wli00bERAEfEXjhtyHabBWQ=; b=P1u3z1v4WTVCD92+FnN3As/j8dqQ3ItWjZt6MqJi7Q6gHlpiwFwPoQO3sOTqWlPmwh aVOh9QCO2qFzULzJlheImRfC/YYn2AxbOvmlpcK55phJFf7KXLPgqo7d+Z9YUYaqMj3w UAhnLcAxbd5eUGGj5VVNiHckeMKG0g5hWaDKLDa+TuJiIHrvQB4MwXv2OkOXwdWRXbxR RWBv1ifCoMbAy0fPu7njhSTviDi5K9c96DCMjYslx4LTIiCrCq3rh6I6kQ1GroQXjGjO 8IzEMkHGdEeFfBgO4Op8po4P5tYH6Yvsjl23YdMyamOvhq9bByk3h6KvGKSYJdtcL9rT 1O0w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x25si1240748edi.76.2020.04.28.00.46.58; Tue, 28 Apr 2020 00:47:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726377AbgD1HnG (ORCPT + 99 others); Tue, 28 Apr 2020 03:43:06 -0400 Received: from mail-wm1-f47.google.com ([209.85.128.47]:54730 "EHLO mail-wm1-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726253AbgD1HnG (ORCPT ); Tue, 28 Apr 2020 03:43:06 -0400 Received: by mail-wm1-f47.google.com with SMTP id h4so1557336wmb.4 for ; Tue, 28 Apr 2020 00:43:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=4+wiF+sn2LhlnwSYXd62Wli00bERAEfEXjhtyHabBWQ=; b=ex1iTblDpoKbmxy8lzOkjpAQg3jBZDCf1WVyM6MetpUsmMzsOPj+lF3pb7wrBlqUEw pmfrM0E2FdPgd5qWM7XlLlPTdJu6L8fUBzSnRQnUIYaGIN7fMQX/gmK2GH40MCcr++Mn Ws0ksPrqysa1mfxtWL6xIZCDkg+aykrdU35RRgQriP9sYNzhSfAGFvddqO2FPvlCcJ9S 6LPyqhmgr7Lodb3caXvIhq50WnqkJLQwH22yipycBinSFPVH6CmRkdyBcrT9+lURv6E/ OK1WCk246XDiDf7bpU97irsZcfROxS/QXwU1t2y3hjN89h4yNtqbjxapwnoV0LM0xrNI lAHg== X-Gm-Message-State: AGi0PuZAg2ojh9sDU735dFJwxJNk+zedCht3iUKR8SAVYCtf3PG7tfGp sCUFZqqJo2CnwJi6SwiwKqc= X-Received: by 2002:a1c:4956:: with SMTP id w83mr2926649wma.43.1588059784050; Tue, 28 Apr 2020 00:43:04 -0700 (PDT) Received: from localhost (ip-37-188-130-62.eurotel.cz. [37.188.130.62]) by smtp.gmail.com with ESMTPSA id c190sm2202066wme.10.2020.04.28.00.43.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Apr 2020 00:43:02 -0700 (PDT) Date: Tue, 28 Apr 2020 09:43:01 +0200 From: Michal Hocko To: Andrew Morton Cc: David Rientjes , Vlastimil Babka , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [patch] mm, oom: stop reclaiming if GFP_ATOMIC will start failing soon Message-ID: <20200428074301.GK28637@dhcp22.suse.cz> References: <20200425172706.26b5011293e8dc77b1dccaf3@linux-foundation.org> <20200427133051.b71f961c1bc53a8e72c4f003@linux-foundation.org> <20200427163558.5b08487d63da3cc7a89bf50b@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200427163558.5b08487d63da3cc7a89bf50b@linux-foundation.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 27-04-20 16:35:58, Andrew Morton wrote: [...] > No consumer of GFP_ATOMIC memory should consume an unbounded amount of > it. > Subsystems such as networking will consume a certain amount and > will then start recycling it. The total amount in-flight will vary > over the longer term as workloads change. A dynamically tuning > threshold system will need to adapt rapidly enough to sudden load > shifts, which might require unreasonable amounts of headroom. I do agree. __GFP_HIGH/__GFP_ATOMIC are bound by the size of the reserves under memory pressure. Then allocatios start failing very quickly and users have to cope with that, usually by deferring to a sleepable context. Tuning reserves dynamically for heavy reserves consumers would be possible but I am worried that this is far from trivial. We definitely need to understand what is going on here. Why doesn't kswapd + N*direct reclaimers do not provide enough memory to satisfy both N threads + reserves consumers? How many times those direct reclaimers have to retry? We used to have the allocation stall warning as David mentioned in the patch description and I have seen it triggering without heavy reserves consumers (aka reported free pages corresponded to the min watermark). The underlying problem was usually kswapd being stuck on some FS locks, direct reclaimers stuck in shrinkers or way too overloaded system with dozens if not hundreds of processes stuck in the page allocator each racing with the reclaim and betting on luck. The last problem was the most annoying because it is really hard to tune for. -- Michal Hocko SUSE Labs