From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1E92C433EF for ; Wed, 16 Mar 2022 00:40:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2C8578D0002; Tue, 15 Mar 2022 20:40:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2771C8D0001; Tue, 15 Mar 2022 20:40:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 118F38D0002; Tue, 15 Mar 2022 20:40:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0224.hostedemail.com [216.40.44.224]) by kanga.kvack.org (Postfix) with ESMTP id EF5688D0001 for ; Tue, 15 Mar 2022 20:40:11 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 8A106182321A0 for ; Wed, 16 Mar 2022 00:40:11 +0000 (UTC) X-FDA: 79248392622.17.1D20D9F Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) by imf05.hostedemail.com (Postfix) with ESMTP id 1362E100004 for ; Wed, 16 Mar 2022 00:40:10 +0000 (UTC) Received: by mail-ej1-f46.google.com with SMTP id dr20so1035359ejc.6 for ; Tue, 15 Mar 2022 17:40:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:reply-to:references:mime-version :content-disposition:in-reply-to:user-agent; bh=jcXfDqdleD8jWRkbjV0N05nVuHrGssQckvhHUoq/WGg=; b=b6v4jP7umY5sxN1xiUDoa2fQsh07jDAZyO21Re1xdf3cfz7Q+8PgnZzCpegZuhfdq8 0YGaKGzCWYqhIRQ/giUDQVOy16dmC5vSaInv1zo18ohyY0mcvGljLHfXlctCWVg11giG m46U/dCZmoRzE4rtfdCu7egnxLmq9gxG4P2muzXZ78oY1Vtnmy6ZS+3D9ChVWLXDwtZD tQIUqbFRBjJWEsN3YVOeMyiVNpl1sv5LAjmp4W/8q/D1cOAkBOCFVYGzcSFVOFYn+n1m eE6oPu97NscIPoFEX/hymDZ0hB9KP6a/Xq38trd9h6Yq65G+6eylN52gsvUAXsrXiEJx ZNpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:reply-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=jcXfDqdleD8jWRkbjV0N05nVuHrGssQckvhHUoq/WGg=; b=rgxQE1n5hwEoX7gMKsZOEIGW+KVFt4hCo2vtr0VH7iC+DWGw4x28/CLqq6rJFfVmc5 hPiiXMBT8pppYbux7ebUaf0xsSB6hHvcbBCfkyD2R2ptSzwrBYyTmXVkC+WAowzYYtrW 9z8oJpnTA1FzKcogAmurTJ63X4tsRDoAoMQbv9Uz6IzSJ4HhLq10LQpmhxZY2xVNMFKi EaMaugChZ1PUNNdIlLP092iD7RpO6lq97CO7nHtJhpu5XRHqQ3wyiMEFjYB++BdN4yJh xQteWaFwsRdgCqQKIq1627RIoUZQYzc7kkkk07Fux+iCBo+/Y4vKfCpkmGDXHxklg0De rAnw== X-Gm-Message-State: AOAM5321UuEqtUCStUB+BYGeN7Zo51R9qzazN/ZVi4gUm+o6/ZfmltZA 8y+od6bIZjLb13xJ/FumPYk= X-Google-Smtp-Source: ABdhPJyB8TZPF7GedEWQFY85EvkH8ScFmNgsBmhQ7UfXDVS1FOCy6Tr2NqG2s1CPSH4I5VxveimHyA== X-Received: by 2002:a17:906:d555:b0:6da:ac8c:f66b with SMTP id cr21-20020a170906d55500b006daac8cf66bmr24317533ejc.107.1647391209681; Tue, 15 Mar 2022 17:40:09 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id s7-20020a170906778700b006df7e0e140bsm15578ejm.140.2022.03.15.17.40.09 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Mar 2022 17:40:09 -0700 (PDT) Date: Wed, 16 Mar 2022 00:40:08 +0000 From: Wei Yang To: Michal Hocko Cc: Wei Yang , akpm@linux-foundation.org, mgorman@techsingularity.net, linux-mm@kvack.org, linux-kernel@vger.kernel.org, David Hildenbrand Subject: Re: [PATCH] mm/page_alloc: add zone to zonelist if populated Message-ID: <20220316004008.kzmhzduqdwqyke5l@master> Reply-To: Wei Yang References: <20220203020022.3044-1-richard.weiyang@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) X-Rspam-User: X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 1362E100004 X-Stat-Signature: 5rj7nncdyo53jxtiwcsp1ofxmctkfiba Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=b6v4jP7u; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf05.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.46 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com X-HE-Tag: 1647391210-160499 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Feb 03, 2022 at 10:27:11AM +0100, Michal Hocko wrote: >On Thu 03-02-22 02:00:22, Wei Yang wrote: >> During memory hotplug, when online/offline a zone, we need to rebuild >> the zonelist for all nodes. Current behavior would lose a valid zone in >> zonelist since only pick up managed_zone. >> >> There are two cases for a zone with memory but still !managed. >> >> * all pages were allocated via memblock >> * all pages were taken by ballooning / virtio-mem >> >> This state maybe temporary, since both of them may release some memory. >> Then it end up with a managed zone not in zonelist. >> >> This is introduced in 'commit 6aa303defb74 ("mm, vmscan: only allocate >> and reclaim from zones with pages managed by the buddy allocator")'. >> This patch restore the behavior. > >It has been introduced to fix a problem described in the the changelog >(FADUMP configuration making kswapd hogging a cpu). You are not >explaining why the original issue is not possible after this change. > After some reading, here is what I find. To prevent this problem again, we need to make sure reclaim only applies to managed_zones. After go through the code, there are only two places we don't guarantee this when iterating zone. 1. skip_throttle_noprogress() 2. throttle_direct_reclaim() After we make sure vmscan only reclaim on managed_zone, the problem won't be possible after this change. BTW, there are another two places use for_each_zone_zonelist_nodemask(). It's ok to not check managed_zone, since actually they are doing a node base iteration. If this looks good to you, I would adjust the changelog and send two patches to fix the above two places. >I also think that this is more of theoretical issue than anything that >is a real life concern. It is good to state that in the changelog as >well. > >That being said I am not against the change but the changelog needs more >explanation before I can ack it. > >> Signed-off-by: Wei Yang >> CC: Mel Gorman >> CC: David Hildenbrand >> Fixes: 6aa303defb74 ("mm, vmscan: only allocate and reclaim from zones with pages managed by the buddy allocator") > >Fixes tag should be really used only if the referenced commit breaks >something. I do not really see this to be the case here. > >Thanks! > -- Wei Yang Help you, Help me