Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3843997rwa; Tue, 23 Aug 2022 11:05:24 -0700 (PDT) X-Google-Smtp-Source: AA6agR7XciHZ4xy2+dvLzg8c82MvwXCiBngaFWb7JaGBdtL+nuICe/eoWWmIhG4UpjecvLqbXDi9 X-Received: by 2002:a17:902:f542:b0:173:a8a:d7bf with SMTP id h2-20020a170902f54200b001730a8ad7bfmr2152391plf.134.1661277924017; Tue, 23 Aug 2022 11:05:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661277924; cv=none; d=google.com; s=arc-20160816; b=AOTSACgBrScbUXLNuIdsZ0TSDKqX/8sN3gUeNsEItjrgN74OR0TgyG3NMxaXoHe6by VotW9XcXpgeYYD6iUysq/1wJT5cy8roGU00g5uvD4sGFBfVdQwQZaFoW8iMVdRv1N9hI 0iMkFlvgkLq8/dvvtnIMlbn5+2uv9CwVMC4lrcBwcKDcn/SxuLKYQ3CXWgcPuIODiJXp xC5fkVAJg0By2hJvZBL+0xcOexYbQj0z5relPz0FopzaNJRlhozTm8d2CPmiq68qIw7I QTsLXRi3oo8ki5uA8TTsCFwRgUr4i4IEyw9HnW4SMULkGu4Iqa0I3GatejIuPHOCyFI3 EpGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=bhjaqTIa02gbjHj3dH3vOefI9qGPqvEV2QWZ9Mh/sjs=; b=q2O0ugkZE6EW6OsAXM/wrdI92Vhik6QYpCnBNC+4C03XjodVhfmgVYYuSiHmapifmn zbyhzsCiS6hfIWs8HhRy/y3ugFjez+7cjpSeil5CBl4m+lAcb0wLdntfiSXolCGxx7mr Sb1xK5ylNdg0DifGJwy3p6YAxPMgKWKbDyHolgOOUMh0Ygo2NG72ybw5Dsk0AnU1WJ2U NN0MuIvEK0i6JdwPm4pLGgJmK51Fpz0CT1CFGlCj8GIAYY/TbPuSPilKsmOFyevci1eU 2MTwuLZMItL6s2LY7qj9QDO/DXUFVNpsp7E/D+B1e/Dc19ty4RGFuSCD0VAHPiolcBXm w5FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=duPLv1Xk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kb16-20020a17090ae7d000b001f317742b05si17196168pjb.145.2022.08.23.11.05.12; Tue, 23 Aug 2022 11:05:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=duPLv1Xk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344087AbiHWRMN (ORCPT + 99 others); Tue, 23 Aug 2022 13:12:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344383AbiHWRKu (ORCPT ); Tue, 23 Aug 2022 13:10:50 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4132D11ECF6 for ; Tue, 23 Aug 2022 06:37:54 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 6EDA11FA9A; Tue, 23 Aug 2022 13:37:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1661261873; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=bhjaqTIa02gbjHj3dH3vOefI9qGPqvEV2QWZ9Mh/sjs=; b=duPLv1XkgQcD6lfKvrfqU0p2OHZvlUpiQNuuWjuitpbV7oc6QTN0XBn7I3HjgyxmYmM+DP eFR10fKwtQRo3owkbpSxYfP/3Cu4HWF5HRP0aE+8fGt5UL+cDIF6FOG0FPk3F0rEcIIZCL NKbqyoESziFyjsAXhJN/I2EDAq4NzVg= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 5DB9513A89; Tue, 23 Aug 2022 13:37:53 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id lXrwFTHYBGPraAAAMHmgww (envelope-from ); Tue, 23 Aug 2022 13:37:53 +0000 Date: Tue, 23 Aug 2022 15:37:52 +0200 From: Michal Hocko To: Liu Shixin Cc: Andrew Morton , Greg Kroah-Hartman , huang ying , Aaron Lu , Dave Hansen , Jesper Dangaard Brouer , Vlastimil Babka , Kemi Wang , Kefeng Wang , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH -next v2] mm, proc: collect percpu free pages into the free pages Message-ID: References: <20220822023311.909316-1-liushixin2@huawei.com> <20220822033354.952849-1-liushixin2@huawei.com> <20220822141207.24ff7252913a62f80ea55e90@linux-foundation.org> <6b2977fc-1e4a-f3d4-db24-7c4699e0773f@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6b2977fc-1e4a-f3d4-db24-7c4699e0773f@huawei.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 23-08-22 20:46:43, Liu Shixin wrote: > On 2022/8/23 15:50, Michal Hocko wrote: > > On Mon 22-08-22 14:12:07, Andrew Morton wrote: > >> On Mon, 22 Aug 2022 11:33:54 +0800 Liu Shixin wrote: > >> > >>> The page on pcplist could be used, but not counted into memory free or > >>> avaliable, and pcp_free is only showed by show_mem() for now. Since commit > >>> d8a759b57035 ("mm, page_alloc: double zone's batchsize"), there is a > >>> significant decrease in the display of free memory, with a large number > >>> of cpus and zones, the number of pages in the percpu list can be very > >>> large, so it is better to let user to know the pcp count. > >>> > >>> On a machine with 3 zones and 72 CPUs. Before commit d8a759b57035, the > >>> maximum amount of pages in the pcp lists was theoretically 162MB(3*72*768KB). > >>> After the patch, the lists can hold 324MB. It has been observed to be 114MB > >>> in the idle state after system startup in practice(increased 80 MB). > >>> > >> Seems reasonable. > > I have asked in the previous incarnation of the patch but haven't really > > received any answer[1]. Is this a _real_ problem? The absolute amount of > > memory could be perceived as a lot but is this really noticeable wrt > > overall memory on those systems? > > This may not obvious when the memory is sufficient. However, as products monitor the > memory to plan it. The change has caused warning. Is it possible that the said monitor is over sensitive and looking at wrong numbers? Overall free memory doesn't really tell much TBH. MemAvailable is a very rough estimation as well. In reality what really matters much more is whether the memory is readily available when it is required and none of MemFree/MemAvailable gives you that information in general case. > We have also considered using /proc/zoneinfo to calculate the total > number of pcplists. However, we think it is more appropriate to add > the total number of pcplists to free and available pages. After all, > this part is also free pages. Those free pages are not generally available as exaplained. They are available to a specific CPU, drained under memory pressure and other events but still there is no guarantee a specific process can harvest that memory because the pcp caches are replenished all the time. So in a sense it is a semi-hidden memory. That being said, I am still not convinced this is actually going to help all that much. You will see a slightly different numbers which do not tell much one way or another and if the sole reason for tweaking these numbers is that some monitor is complaining because X became X-epsilon then this sounds like a weak justification to me. That epsilon happens all the time because there are quite some hidden caches that are released under memory pressure. I am not sure it is maintainable to consider each one of them and pretend that MemFree/MemAvailable is somehow precise. It has never been and likely never will be. -- Michal Hocko SUSE Labs