Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2762641pxk; Tue, 15 Sep 2020 01:24:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTY9mFneLdQY7Wqql4dXq1T7fmqZ8dTZusPSn7zNnaTGIaRjfQaiBFcE8Gx+mCBKZAGPLH X-Received: by 2002:aa7:d8d8:: with SMTP id k24mr20671071eds.97.1600158293593; Tue, 15 Sep 2020 01:24:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600158293; cv=none; d=google.com; s=arc-20160816; b=wV7fX9BL69Ruc1csp2ocrjkNeNeaE7diezD3B0Y5WP1cut0uuG0j2NuWb0gN8t9ToR Hm6LTewmQjcMjQSaQHLTd47ALk7B/yQ4HGGiqO/cLad5HbPyBStUtFiTvo4m95JDR8NG RxGhlFxoTKfmVIrP5lxFZVpGLYoYrn+Fy0b7iwqQG79jjp6VKMqRJ6qcB9KnpPZ09LRw IMW78VnJbD+YkT7mLNifIa+EiOfKcBimLlT1Y/mFZYCxcGnZ7/5QmWWHIYQgsnVreuSC asQc5gFRB/LiUnPvtR1SwXl/Z1A0vVzCpEAf2/t7KrylEa1pIIwaEWn8p3pS7Bc+uEY3 yEXQ== 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=qZl/Eg9Z/m3tFMRA5WaZ0Y1B7eHe5lxagwi9bsVHQmM=; b=IoI2FMOQChzEFsVpX0K22dyRpJBzsPi5anGRXm+cpNaqb+PEotn22/efukDjNWZ75Z YQDEMAtGL6QMXeKYDqoWvxNXJ0YGMWL5ghPZQ+RHq930eZm3A0zw2mvJ/AX5pWPtCb7I 4Yh6hfXznX7VybLLQaBHh1QdID2v5R/nxKrmEMDBPjiARbsbcF82czU+AEvIX1KM1lTG HzIhvVh8giHzZjXWVnycKc8a1oBxgix71e7GLlbHF4TtIN6vggzMmZs7ytqCdMzopDhc uF4hQI6DSBbhbZS31w3upyV/0E0HX0s3bVZTF0RCPeRbQ7o0ds60sYwLb5oo3rwzlJIC iSFA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n11si8620913ejh.372.2020.09.15.01.24.31; Tue, 15 Sep 2020 01:24:53 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726348AbgIOIWy (ORCPT + 99 others); Tue, 15 Sep 2020 04:22:54 -0400 Received: from mx2.suse.de ([195.135.220.15]:36302 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726342AbgIOISv (ORCPT ); Tue, 15 Sep 2020 04:18:51 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id D2FFEB042; Tue, 15 Sep 2020 08:18:48 +0000 (UTC) Date: Tue, 15 Sep 2020 10:18:32 +0200 From: Michal Hocko To: Vijay Balakrishna Cc: Andrew Morton , "Kirill A. Shutemov" , Oleg Nesterov , Song Liu , Andrea Arcangeli , Pavel Tatashin , Allen Pais , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [[PATCH]] mm: khugepaged: recalculate min_free_kbytes after memory hotplug as expected by khugepaged Message-ID: <20200915081832.GA4649@dhcp22.suse.cz> References: <1599770859-14826-1-git-send-email-vijayb@linux.microsoft.com> <20200914143312.GU16999@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 14-09-20 09:57:02, Vijay Balakrishna wrote: > > > On 9/14/2020 7:33 AM, Michal Hocko wrote: > > On Thu 10-09-20 13:47:39, Vijay Balakrishna wrote: > > > When memory is hotplug added or removed the min_free_kbytes must be > > > recalculated based on what is expected by khugepaged. Currently > > > after hotplug, min_free_kbytes will be set to a lower default and higher > > > default set when THP enabled is lost. This leaves the system with small > > > min_free_kbytes which isn't suitable for systems especially with network > > > intensive loads. Typical failure symptoms include HW WATCHDOG reset, > > > soft lockup hang notices, NETDEVICE WATCHDOG timeouts, and OOM process > > > kills. > > > > Care to explain some more please? The whole point of increasing > > min_free_kbytes for THP is to get a larger free memory with a hope that > > huge pages will be more likely to appear. While this might help for > > other users that need a high order pages it is definitely not the > > primary reason behind it. Could you provide an example with some more > > data? > > Thanks Michal. I haven't looked into THP as part of my investigation, so I > cannot comment. > > In our use case we are hotplug removing ~2GB of 8GB total (on our SoC) > during normal reboot/shutdown. This memory is hotplug hot-added as movable > type via systemd late service during start-of-day. > > In our stress test first we ran into HW WATCHDOG recovery, on enabling > kernel watchdog we started seeing soft lockup hung task notices, failure > symptons varied, where stack trace of hung tasks sometimes trying to > allocate GFP_ATOMIC memory, looping in do_notify_resume, NETDEVICE WATCHDOG > timeouts, OOM process kills etc., During investigation we reran stress test > without hotplug use case. Surprisingly this run didn't encounter the said > problems. This led to comparing what is different between the two runs, > while looking at various globals, studying hotplug code I uncovered the > issue of failing to restore min_free_kbytes. In particular on our 8GB SoC > min_free_kbytes went down to 8703 from 22528 after hotplug add. Did you try to increase min_free_kbytes manually after hot remove? Btw. I would consider oom killer invocation due to min_free_kbytes really weird behavior. If anything the higher value would cause more memory reclaim and potentially oom rather than smaller one. -- Michal Hocko SUSE Labs