Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp7594723rwi; Mon, 24 Oct 2022 17:21:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4aodrgm8Za18SBJtqYo3V/QnWa4khjidce4/uqfMh0pmH2tiiUYwcw4qDj0dt7QSGVKuqF X-Received: by 2002:a63:2dc3:0:b0:46b:3cf1:e16c with SMTP id t186-20020a632dc3000000b0046b3cf1e16cmr30325725pgt.556.1666657303535; Mon, 24 Oct 2022 17:21:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666657303; cv=none; d=google.com; s=arc-20160816; b=K+PBEMO3jab3NQ1OJIKCbSoKCZr96gF/M73H3+sFTVNDSWPhpqKCu1QJKL7/M4o1bR 0qe0xPwFXWEWCMX8j/Inv8Ahoiu27Qobs83+hqm5dywXxA9d0LOusJXTujtUNz+M8AXi LaK1GqDW4n5Nu39LRPDqDXBeGtZW9+/lx095k7/a+Cw2YY/8ctPJI3chDOrUrZcMv0hJ ht5yxdSyZJkSLd9f5+zABTJMzOFC6hkjg06RV65S8TXdw+13k8oWTAk8S0H2wDGwib0H OL3MIApuvPJkMgdRZNP6gAZ2ipgeKs80CnjAGuTXPHd6E1w/wsE+jzNDr4cGrCdE6IxE /hjg== 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=oyHbKLUYwkq4oCXdP1CUlTZ2li2EjNPUvoP3vey4oD4=; b=rD0u4erkUJT/akvlxBGdVo43JUvKF2F4isCIrmV713OpMlkpFsZREXYRYG+GbQosf5 sQIIdFgjN4eD4hZipU18KiUZYQeqYHrOyUZ+PTkF/8t7OwQjUMQoQ8OFIlmv6l37DL80 XDEKCizq14lJf2iki7Z8XxZKSfIQb6m5e8xGUizy543sdMIveUnm5P7WzNgY1zmns/CF MQ6WFqtB7xRDbHwUsIph3iCDhqVRQgrhvARFutvZv4PIAvoClcfD2i5kas7SOROjnnh6 HsoCAhPmGUiLOyGwZlS7YWQJ6XObxvlATlgdowhu87wK7DEwI5Ny48edYT7lLW5PQrFs OtBw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rj1-20020a17090b3e8100b0020f8385ca87si1757030pjb.94.2022.10.24.17.21.31; Mon, 24 Oct 2022 17:21:43 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230234AbiJYAHc (ORCPT + 99 others); Mon, 24 Oct 2022 20:07:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230472AbiJYAHI (ORCPT ); Mon, 24 Oct 2022 20:07:08 -0400 Received: from outbound-smtp39.blacknight.com (outbound-smtp39.blacknight.com [46.22.139.222]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE7215B78A for ; Mon, 24 Oct 2022 15:25:05 -0700 (PDT) Received: from mail.blacknight.com (pemlinmail03.blacknight.ie [81.17.254.16]) by outbound-smtp39.blacknight.com (Postfix) with ESMTPS id 6DCF722C2 for ; Mon, 24 Oct 2022 15:55:57 +0100 (IST) Received: (qmail 12650 invoked from network); 24 Oct 2022 14:55:57 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.198.246]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 24 Oct 2022 14:55:57 -0000 Date: Mon, 24 Oct 2022 15:55:55 +0100 From: Mel Gorman To: Chen Wandun Cc: akpm@linux-foundation.org, vbabka@suse.cz, linux-mm@kvack.org, linux-kernel@vger.kernel.org, wangkefeng.wang@huawei.com Subject: Re: [PATCH] mm: fix pcp count beyond pcp high in pcplist allocation Message-ID: <20221024145555.oaoisy6m723h4axc@techsingularity.net> References: <20221024134146.3442393-1-chenwandun@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20221024134146.3442393-1-chenwandun@huawei.com> X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS 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 Mon, Oct 24, 2022 at 09:41:46PM +0800, Chen Wandun wrote: > Nowadays there are several orders in pcplist, Function __rmqueue_pcplist > would alloc pcp batch pages to refill pcplist, when list of target order > if empty meanwhile other lists is not all empty, that result in pcp count > beyond pcp high after allocation. This behaviour can be easily observed by > adding debugging information in __rmqueue_pcplist. > > Fix this by recalculate the batch pages to be allocated. Are any problems observed other than the PCP lists temporarily exceed pcp->high? As is, the patch could result in a batch request of 0 and fall through to allocating from the zone list anyway defeating the purpose of the PCP allocator and probably regressing performance in some csaes. The intention was to allow high to be briefly exceeded on the refill side, particularly for THP pages and to always refill by at least two pages. In the THP case, one would be allocated and maybe one in the near future without acquiring the zone lock. If the limits are exceeded, it's only exceeded until the next free. -- Mel Gorman SUSE Labs