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 692D5C48BEB for ; Wed, 21 Feb 2024 22:15:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BAD5C6B007E; Wed, 21 Feb 2024 17:15:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B35FC6B0083; Wed, 21 Feb 2024 17:15:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9FD256B0085; Wed, 21 Feb 2024 17:15:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 905EE6B007E for ; Wed, 21 Feb 2024 17:15:11 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 303AA40AAE for ; Wed, 21 Feb 2024 22:15:11 +0000 (UTC) X-FDA: 81817217622.09.67169B7 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf16.hostedemail.com (Postfix) with ESMTP id 3AEC9180013 for ; Wed, 21 Feb 2024 22:15:08 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=S040VVPj; dmarc=none; spf=pass (imf16.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708553709; 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:dkim-signature; bh=Qe2hd1pYN4ssXl+aciLN4l91Xk7XU4FHxYJfEhUZ/dM=; b=GVsdR5iEJrAaWBtO/CFIGahv1o3zUxUmjEmSogp1gIfRu/7I5HIwxKGWGPQHPCA1gWYITV eSnF1SyxZ+DjXTBUFw6r5p4E0DrwM+Qn5iHvmcKPcSVcBOfzc4u6tGAeB6s2rWtIcRyCWT kTce87mvaXATm1iGLcUHHiK4/H1vHsU= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=S040VVPj; dmarc=none; spf=pass (imf16.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708553709; a=rsa-sha256; cv=none; b=M2Zi8fxPBGhwZrRxMpkN762H2QKIDJ+1tG3g243ezTFZEMp7Flh/uNFUmBL3nKuBv5L9wC 6sz0m4RDSnY3ygaI+JX7WLI/87Hrefe9xZ9SlzEEE8mUQKD7HBCEwf9l3+RKiCntMSglhE rFiuGXgtwrPJBkGKOxpHmwc6A6VzaaU= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 4C8CFCE1F97; Wed, 21 Feb 2024 22:15:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 534B5C433C7; Wed, 21 Feb 2024 22:15:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1708553705; bh=pVsIndEbFUfPsGagLBr+KPbde70KmO6aWFeU/fLbpjI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=S040VVPjk1Bp+pNjJutpGTQzoGao39dhsaZjMPROjzlanWRpsHOQC+ct+rVacI6Sa p3U5uV3XZfsUIn1nNHhuLbgJV1BIicgGr4lzoIDgjcuItG/aRgh+ItkDr8OvDsARAM L9rx5y1/uww8wzyT8tsYTd1PrybWbYrYlgS3Qikk= Date: Wed, 21 Feb 2024 14:15:04 -0800 From: Andrew Morton To: Baolin Wang Cc: Zi Yan , Vlastimil Babka , mgorman@techsingularity.net, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] mm: compaction: limit the suitable target page order to be less than cc->order Message-Id: <20240221141504.3c3cec674553b4df4bd72ec1@linux-foundation.org> In-Reply-To: <83bc1070-2eb4-4fac-aecf-9cc407003ca2@linux.alibaba.com> References: <20c8fa7c-62ae-4e48-aaec-8b512519cee9@suse.cz> <5277627F-6791-46A1-AFC2-54FBF0DABF1A@nvidia.com> <83bc1070-2eb4-4fac-aecf-9cc407003ca2@linux.alibaba.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 3AEC9180013 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: tmm7nuibjghixo885tkehnfm8r3snz47 X-HE-Tag: 1708553708-474148 X-HE-Meta: U2FsdGVkX19AAChrkymDIvLte/xZEKPljFUE2Udwt+3rtMiLLzZXFHucfM+pJHlknMW3o/hzgXPM120xcMMSLxL+dvJtJclo8LPO9sz8dihe+QzJYoMP+0ywNgWfE9aAdzE29uoOy4JYXee08jl5ffjqoVMNEFk7nIcX/DMpG/D5AYlz0IjiG5Xa5YV8AOvaejcOrtGGf/nFePox9SskwdEHNAUBCDXPENzS4ifHCuCbQ2e+Z6EZjYlcfu7E9fybMuu1c81dKZLOFRjNynkZYPU8WBRiNRRrcVwULKUEPhNxrkM6qeDyVbNHtcNkhdYnOKNQxvMItac+Ioe7CruCUaHm/P4c5lo07ZM5umYgRCP4pAXhulMhx8UpgfsWmbRBnpYjHVFKEdMLaVezFubxbC3W0oWnpFlXQHOPzF0I7lPi3uCPYfF5dkoTdLXyItYnCyCLwkBwrlYygqwghaqheHZn14/l7drvdbkIHK7ERYhpxjar37u8VV3cFjcHMZF6Sm1jGV6LfLLANBUatSCEs0lUcPwuxuvn/moxAJQyPoX+PO5JxxKiPA0oYOr9bwWSAGP+MJ8uYG9Ck/tVdoSs7842bcY56TEakyrIhiOwE7TTa6iAxaKowZl7PRXbvUeEutsmfkGMG5R/GIzLVtTtmAO2sgDGb4pInt/sG38YNeQqlgAdW2LZDlL7CqsyVafwDr3tS3drLcpXwARtiKsrDWBgNeHewoSJbtYF9xLMh7aABgfZW0MKNvJiRJsSErQ2xVRlfdAN+llf+sbHiy6IOLEFKidIQcB/GmPf1M8eovgk2uEE9Py0NJ4xtpW4AU3U52ICy1f/w+7q466qXrF3Ez/9TzVsriq+iMzooFBhpoqb4rpisWZ8h9u7sW7GesumqWMhpBLlkq7NhTFfJqOsDnoY0Hfjz5K5GyQd7bcFTiE= 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: List-Subscribe: List-Unsubscribe: On Mon, 19 Feb 2024 10:55:59 +0800 Baolin Wang wrote: > > > On 2024/2/12 23:00, Zi Yan wrote: > > On 12 Feb 2024, at 4:13, Vlastimil Babka wrote: > > > >> On 1/22/24 14:01, Baolin Wang wrote: > >>> It can not improve the fragmentation if we isolate the target free pages > >>> exceeding cc->order, especially when the cc->order is less than pageblock_order. > >>> For example, suppose the pageblock_order is MAX_ORDER (size is 4M) and cc->order > >>> is 2M THP size, we should not isolate other 2M free pages to be the migration > >>> target, which can not improve the fragmentation. > >>> > >>> Moreover this is also applicable for large folio compaction. > >> > >> So why not Cc: Zi Yan? (done) > >> > > > > Thanks. > > > > Hi Baolin, > > > > How often do you see this happening? > > This is theoretically analyzed from the code inspection. > > >>> Signed-off-by: Baolin Wang > >> > >> I doubt this will make much difference, because if such a larger order free > >> page exists, we shouldn't have a reason to be compacting for a lower order > >> in the first place? > > > > Unless kswapd gets us such a free block in the background right after > > get_page_from_freelist() and before compaction finishes in the allocation > > slow path. > > > > If this happens often and cc->order is not -1, it might be better to stop > > compaction and get_page_from_freelist() to save cycles on unnecessary pfn > > scanning. For completeness, when cc->order == -1, the logic does not change. > > Yes, this is one possible case. There are also some other concurrent > scenarios, such as when compaction is running (after > compaction_suitable()), at the same time, other applications release a > large folio to the free list. In this case, the free large folio > scanning should also be avoided. This went quiet. We have an ack from Mel. Are people OK with sending this change upstream?