Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp3167016rdb; Thu, 16 Nov 2023 01:59:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IHqvau0F3yH/721cUxwCKTEOVfbOqNO3JTz2x4osTdRd4PACsugiG8sAMsuN4rlZ7Se4E4a X-Received: by 2002:a17:90b:3ec1:b0:27d:4b20:3604 with SMTP id rm1-20020a17090b3ec100b0027d4b203604mr13227698pjb.27.1700128765166; Thu, 16 Nov 2023 01:59:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700128765; cv=none; d=google.com; s=arc-20160816; b=Cv0h1le4IRivjpA4VE5yg35J7UB4Lh710yHs/K0J6ii78O0c1fOCb0kw/yj57VmpWQ kZFtc01ozKWn/m9LeqMcH8wJF3/vpETU3bRpYokwvdOS87iozIxyVEXkVFYejW4dvQpw rKmWF8cp1hfeBmRjaOkHsUH10SjO+iZaKtNnzsQ1KKsPfxKxsNPtY7HOsGc50R/tSeKo sxtrF/J6GV2UN81F8tC0HXdeQ9FZqCDA8WMj/MHQdg+T3JKMCd9xnM01UMCPMDN3Noq3 PqmVB3PJJbV1HMqSM4sRu4jfNxmlz+MUb815PbYTDmu8Nt3MRrfUZRvrgFwewYhxH1MM gINw== 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; bh=/HG3tlzMibBl6Jhvgz0RxMtSRco3o3vqgZJv0w/Dj18=; fh=H+2nWcllSkOLQjdHkHErGy7+IL+wfZWMo2JoImZryrU=; b=SYg1Hy+JwTuweuv2guBu8A8CU9cKh8MrcaU7FGPkwvGUYl42vNE1BqYXBghN/7+9Re BmMULMp/PuYBGXv2ORj+f3qR3v9PRjXzWlzOmxijosskvxtooCSMfMOLuu9NTLG5sXCM GBvTrSUp2JcejgDIrAZnf7t8TROhzOHiQYGKjhycgl9AFLwvLzYlJx7ZSi1cAQdNvQRb mm6d47xkyO1355DCpy5O0PmqrAtxeT1UtugMVn2A3nqUxTNYFRNQnl8cBIy7ou1BrG32 nWqi0/6Hx3KJ2aXf4XJZQNtkE/otVwAbKmrQMC1D8sLClJIB6bOXtYUMRmfOW1R/cZ+6 PJTA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id j23-20020a17090ae61700b0027d10266b46si1645134pjy.122.2023.11.16.01.59.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 01:59:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id D077580EA966; Thu, 16 Nov 2023 01:59:22 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230254AbjKPJ7K (ORCPT + 99 others); Thu, 16 Nov 2023 04:59:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229749AbjKPJ7J (ORCPT ); Thu, 16 Nov 2023 04:59:09 -0500 Received: from outbound-smtp16.blacknight.com (outbound-smtp16.blacknight.com [46.22.139.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B05EC5 for ; Thu, 16 Nov 2023 01:59:04 -0800 (PST) Received: from mail.blacknight.com (pemlinmail05.blacknight.ie [81.17.254.26]) by outbound-smtp16.blacknight.com (Postfix) with ESMTPS id C087B1C405A for ; Thu, 16 Nov 2023 09:59:02 +0000 (GMT) Received: (qmail 17829 invoked from network); 16 Nov 2023 09:59:02 -0000 Received: from unknown (HELO mail.blacknight.com) (mgorman@techsingularity.net@[81.17.254.19]) by 81.17.254.26 with ESMTPA; 16 Nov 2023 09:59:02 -0000 Date: Thu, 16 Nov 2023 09:59:01 +0000 From: Mel Gorman To: Charan Teja Kalla Cc: akpm@linux-foundation.org, mhocko@suse.com, david@redhat.com, vbabka@suse.cz, hannes@cmpxchg.org, quic_pkondeti@quicinc.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V2 2/3] mm: page_alloc: correct high atomic reserve calculations Message-ID: <20231116095901.72oqtjoiqzt3tfhj@techsingularity.net> References: <905d99651423ee85aeb7a71982b95ee9bb05ee99.1699104759.git.quic_charante@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <905d99651423ee85aeb7a71982b95ee9bb05ee99.1699104759.git.quic_charante@quicinc.com> X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 16 Nov 2023 01:59:23 -0800 (PST) On Sun, Nov 05, 2023 at 06:20:49PM +0530, Charan Teja Kalla wrote: > reserve_highatomic_pageblock() aims to reserve the 1% of the managed > pages of a zone, which is used for the high order atomic allocations. > > It uses the below calculation to reserve: > static void reserve_highatomic_pageblock(struct page *page, ....) { > > ....... > max_managed = (zone_managed_pages(zone) / 100) + pageblock_nr_pages; > > if (zone->nr_reserved_highatomic >= max_managed) > goto out; > > zone->nr_reserved_highatomic += pageblock_nr_pages; > set_pageblock_migratetype(page, MIGRATE_HIGHATOMIC); > move_freepages_block(zone, page, MIGRATE_HIGHATOMIC, NULL); > > out: > .... > } > > Since we are always appending the 1% of zone managed pages count to > pageblock_nr_pages, the minimum it is turning into 2 pageblocks as the > nr_reserved_highatomic is incremented/decremented in pageblock sizes. > > Encountered a system(actually a VM running on the Linux kernel) with the > below zone configuration: > Normal free:7728kB boost:0kB min:804kB low:1004kB high:1204kB > reserved_highatomic:8192KB managed:49224kB > > The existing calculations making it to reserve the 8MB(with pageblock > size of 4MB) i.e. 16% of the zone managed memory. Reserving such high > amount of memory can easily exert memory pressure in the system thus may > lead into unnecessary reclaims till unreserving of high atomic reserves. > > Since high atomic reserves are managed in pageblock size granules, as > MIGRATE_HIGHATOMIC is set for such pageblock, fix the calculations for > high atomic reserves as, minimum is pageblock size , maximum is > approximately 1% of the zone managed pages. > > Signed-off-by: Charan Teja Kalla This patch in isolation seems fine with the caveat that such a small system may find the atomic reserves to be borderline useless. Acked-by: Mel Gorman -- Mel Gorman SUSE Labs