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 CBE9AFA373D for ; Mon, 24 Oct 2022 14:56:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 413AA940009; Mon, 24 Oct 2022 10:56:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3C455940007; Mon, 24 Oct 2022 10:56:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2B3AF940009; Mon, 24 Oct 2022 10:56:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 1D761940007 for ; Mon, 24 Oct 2022 10:56:01 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id D529580C34 for ; Mon, 24 Oct 2022 14:56:00 +0000 (UTC) X-FDA: 80056142880.05.C8C4AFA Received: from outbound-smtp48.blacknight.com (outbound-smtp48.blacknight.com [46.22.136.219]) by imf19.hostedemail.com (Postfix) with ESMTP id 488271A0002 for ; Mon, 24 Oct 2022 14:56:00 +0000 (UTC) Received: from mail.blacknight.com (pemlinmail03.blacknight.ie [81.17.254.16]) by outbound-smtp48.blacknight.com (Postfix) with ESMTPS id D714DFB020 for ; Mon, 24 Oct 2022 15:55:58 +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> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666623360; a=rsa-sha256; cv=none; b=YC6wO4DFdQZvYDgNYCTotC7ZAxNgYhJziDkvNKnTrQHlRgB14WcG43UhldUi0aDI+ke7qi gKeg7dIpgOeBBC3A2v2YK0/cQhWl37tzVd1SDpv9T9QMVpWU0zGOlNIwp9WHLJxMbf4iRp K+j+T2BfHvh9S+rnW5+r73wa5F6aYMI= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf19.hostedemail.com: domain of mgorman@techsingularity.net designates 46.22.136.219 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666623360; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oyHbKLUYwkq4oCXdP1CUlTZ2li2EjNPUvoP3vey4oD4=; b=zj54M8h5iJ/HPCc/H9QK8laOnntfLTsJXFkufTYP1hoSNRXTVviweiCqfmGTcMFdcjMy3W MOjL+0qZ7ggUjBXGtvrvOqEKZpwoD/SA1hUNsp47pLgE6UJYefFgnvGFL252qgzgW/hGB3 eyLzVJ+lpKsC5OI9ghcM8SI0UlSgilo= Authentication-Results: imf19.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf19.hostedemail.com: domain of mgorman@techsingularity.net designates 46.22.136.219 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net X-Rspamd-Server: rspam04 X-Rspam-User: X-Stat-Signature: q7notsu1rwyzfcn6y8dnq8gus6eyco63 X-Rspamd-Queue-Id: 488271A0002 X-HE-Tag: 1666623360-334872 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 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