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 BEE21C04A95 for ; Tue, 25 Oct 2022 13:20:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3302A8E0002; Tue, 25 Oct 2022 09:20:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2E02D8E0001; Tue, 25 Oct 2022 09:20:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1CF0C8E0002; Tue, 25 Oct 2022 09:20:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 0EC008E0001 for ; Tue, 25 Oct 2022 09:20:04 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id B5530140EF6 for ; Tue, 25 Oct 2022 13:20:03 +0000 (UTC) X-FDA: 80059529886.27.D2A68BE Received: from outbound-smtp27.blacknight.com (outbound-smtp27.blacknight.com [81.17.249.195]) by imf20.hostedemail.com (Postfix) with ESMTP id 13D931C004B for ; Tue, 25 Oct 2022 13:20:02 +0000 (UTC) Received: from mail.blacknight.com (pemlinmail02.blacknight.ie [81.17.254.11]) by outbound-smtp27.blacknight.com (Postfix) with ESMTPS id 77F22CAF43 for ; Tue, 25 Oct 2022 14:20:01 +0100 (IST) Received: (qmail 976 invoked from network); 25 Oct 2022 13:20:01 -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); 25 Oct 2022 13:20:01 -0000 Date: Tue, 25 Oct 2022 14:19:59 +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: <20221025131959.sd47fipimhehf76i@techsingularity.net> References: <20221024134146.3442393-1-chenwandun@huawei.com> <20221024145555.oaoisy6m723h4axc@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666704003; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wtNxZBFNlqjQSjhlpd9kdFx0aqORY3rs2duu4G1TJtk=; b=D9Qsk38ooVSap2zncblFpdQpLJBkIkx+xpeFnEpDXznaa3ykwMzzKvJkqFRYqSkKSBfyb0 HKdxcNm4RmAA8o8FNp04+khNDiN2yOkRZd/ezUDyIpVgYkJUPucU9S1qC06Itug7p3S56U gMt5XWMh8YbqXS1M+suJ88jP1hO877A= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf20.hostedemail.com: domain of mgorman@techsingularity.net designates 81.17.249.195 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666704003; a=rsa-sha256; cv=none; b=Tc880ECT8XAespmCbECNyZpgI7Lv5ChgOabQynDpmmiWpRklD6HOvgcxdcSC/0XzW4a6zq Vq2qhrKU5jrzWwQkKDuTeX1HisRsEZmcJbvebUpUxBzbLqsBlX7sfi7BrTuTXtrGxqIn+F SN1oX+gJoKaw1bBjfz7FoCzNx0LQCTI= X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 13D931C004B X-Rspam-User: Authentication-Results: imf20.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf20.hostedemail.com: domain of mgorman@techsingularity.net designates 81.17.249.195 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net X-Stat-Signature: 3djzjr3541ym1x17w95bwpkgk658d18w X-HE-Tag: 1666704002-750883 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 Tue, Oct 25, 2022 at 07:49:59PM +0800, Chen Wandun wrote: > > > On 2022/10/24 22:55, Mel Gorman wrote: > > 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? > > It will result frequently refill pcp page from buddy and release pcp page to > buddy. Under what circumstances does this causes a problem? I 100% accept that it could happen but one downside of the patch is that it simply changes the shape of the problem. If the batch refill is clamped then potentially the PCP list is depleted quicker and needs to be refilled sooner and so zone lock acquisitions are still required potentially higher frequency due to clamped refill sizes. All that changes is the timing. > > As is, the patch could result in a batch request of 0 and > >  I foget this, the patch need some improve, thanks. > > > fall through to allocating from the zone list anyway defeating the > > purpose of the PCP allocator and probably regressing performance in some > > csaes. > > Same as I understand???how about set high/batch for each order in pcplist??? Using anything would than (X >> order) consumes storage. Even if storage was to be used, selecting a value per-order would be impossible because the correct value would depend on frequency of requests for each order. That can only be determined at runtime and the cost of determining the value would likely exceed the benefit. At most, you could state that the batch refill should at least be 1 but otherwise not exceed high. The downside is that zone->lock contention will increase for a stream of THP pages which is a common allocation size. The intent behind batch-2 was to reduce contention by 50% when multiple processes are faulting large anonymous regions at the same time. THP allocations are ones most likely to exceed pcp->high by a noticeable amount. > or just share pcp batch value only set high for each order? It looks like > strange for pcp count beyond pcp high in common case. > > If each order has it's own pcp high value, that behaviour is same as pcplist > which > only contains order 0. > Specify in the changelog how a workload is improved. That may be in terms of memory usage, performance, zone lock contention or cases where pcp->high being exceeded causes a functional problem on a particular class of system. -- Mel Gorman SUSE Labs