Received: by 2002:ab2:7041:0:b0:1f4:bcc8:f211 with SMTP id x1csp210882lql; Fri, 12 Apr 2024 08:12:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUCuSWTrXq1elnPeAMLjC3uv4aH81OlqXHLxoD4jVlL9wuiHdC4ALoslvlkXeguk2if41RhnJ8w6PbVyUML9BEeieW/Oe/sCUKWhDvZQg== X-Google-Smtp-Source: AGHT+IFFFUDP+jd7y9CbQ4UlaQ9mpwz3QHdQno7YCYyQtbML8iDJEhFd89ZIqovV0RPEDvfAZNbM X-Received: by 2002:a05:6512:481:b0:516:d504:5ae8 with SMTP id v1-20020a056512048100b00516d5045ae8mr2128946lfq.21.1712934721835; Fri, 12 Apr 2024 08:12:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712934721; cv=pass; d=google.com; s=arc-20160816; b=nRc+8kL4NMwoMvGR89x8LPnNbzQd9YGqANQZNMkq1oZUbKMmRdsL9FiCeZb94RiEPd OrA2lbmA/MDtFgvskonCM4KdzuHo9HW2NSJop+Ul5ufyS9eQkRL2P/VChFaoWxURvX/4 +5NvbQtd+uJmG8SYQQSKMOYNva2d4NUGGn72dQTiQSHZKNTKqFotaYXzSE3vKRiRKWDF g2fJ9wqyxdDvxUAjsQ18J8k4BraMZSck5PT5CbxsoNygeoQsHK23e1se2Fy/s5v93sEf aWEecB7R1zAjZfJxkp2cHGTNxl7cs9b62tq5y1Y9unWT6Zc/0VgYXaPec3jzqaDydbys nwuA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=umYWg6DJW6vGydBITxbBeNK9gyCVaIMoQCthI2KA6Yo=; fh=MQ8h9v+4snzsforMCi3e0GUUjpFwT7k6ysV5Myjl8Jw=; b=sRT6YAsH8H2gys9JQobOJ2Zyl4K4uWbbSyE8lAivMgfrY7yNNOQZQW2GyJ0WpkSsYS cq7onbx9fPGHhpVPbUh6PgKGaoqfi5A1RlWL7CGWruQBVIJUf60Zaz0LBm3MnKDIIpvl ysmReDex37BXV8UJQumyEz0/pW4ax6js3CqFKWnTCPbZvk9/NB/UGV5hh6p1QvnvAzN9 mGDAlymsSvrBZ+xt0knsVhJ2xYZsOPSeIuxmfF7Huevwy8/9OfDLKmj654x/xnsViBVz xO93RizgjT0iRpotu9syWo4FYR9TwyWc9Mou2p0jjrjt70tZT+6GXdAzav2GY4z+SrCR JxAQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=xSfN24eT; arc=pass (i=1 spf=pass spfdomain=cmpxchg.org dkim=pass dkdomain=cmpxchg-org.20230601.gappssmtp.com dmarc=pass fromdomain=cmpxchg.org); spf=pass (google.com: domain of linux-kernel+bounces-142900-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142900-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id ay9-20020a170906d28900b00a51aad6c6dfsi1832994ejb.980.2024.04.12.08.12.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 08:12:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-142900-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=xSfN24eT; arc=pass (i=1 spf=pass spfdomain=cmpxchg.org dkim=pass dkdomain=cmpxchg-org.20230601.gappssmtp.com dmarc=pass fromdomain=cmpxchg.org); spf=pass (google.com: domain of linux-kernel+bounces-142900-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142900-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 0494B1F239DC for ; Fri, 12 Apr 2024 15:11:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 77B9214830A; Fri, 12 Apr 2024 15:11:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg-org.20230601.gappssmtp.com header.i=@cmpxchg-org.20230601.gappssmtp.com header.b="xSfN24eT" Received: from mail-ot1-f44.google.com (mail-ot1-f44.google.com [209.85.210.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 879011482E2 for ; Fri, 12 Apr 2024 15:11:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712934673; cv=none; b=ioJJ1rFBywefxM90utcTODSqceFiDicdqEkamyWG8nawVC9enSYzL4F2F9cxPmDuLxCEe5LEuqexksKmB+x77/Sz7EcgTs2vNIWAVi6ymcZTdpP+pfU11pFHvtLHRE++PfxxCT4uFWWMDV9/9PFfSVX3IuoZyztqHQwHcckAVLo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712934673; c=relaxed/simple; bh=/SNKWHzb8Q8lo/dsYSxKZd6OF82LMq9s5w+1CP+/6aA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=s4r4yjeJwTtdyPgsMOxA4vFv980mvJ5QLA+PD2oU6m+U4jXHEtvbwWlqnWExKmtuhgmxuDweBWUPhR8fu/T7zX/HJ3NKivs/nYKSyJexqa9HentSXuUXxgTFqmrxliMJq5vHfX8M3/pmT/W10hcHKEhm9NTfwjmzAosSFF4Rfg0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org; spf=pass smtp.mailfrom=cmpxchg.org; dkim=pass (2048-bit key) header.d=cmpxchg-org.20230601.gappssmtp.com header.i=@cmpxchg-org.20230601.gappssmtp.com header.b=xSfN24eT; arc=none smtp.client-ip=209.85.210.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cmpxchg.org Received: by mail-ot1-f44.google.com with SMTP id 46e09a7af769-6ea1d2c1d58so536858a34.3 for ; Fri, 12 Apr 2024 08:11:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1712934669; x=1713539469; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=umYWg6DJW6vGydBITxbBeNK9gyCVaIMoQCthI2KA6Yo=; b=xSfN24eT7mjdX7bqOgymJMWBwwzaDeM+TZH6PRO5AIYc1SI7p14rdHJkcTYF1qqk1f w5znOL19w4zVVpQ9CI8TRXHH/vQEsIu+KJcTbM7lKxOhC4XySpz7Wp93xrzdxI0TSgcC D0VqyHwVsyL4egz+J4VotvMpzEZC8coOvl9vvReVNCuAWzyN2lu+84ecvNwuPFUg6McE bFoEEgfkOvUxjk0RA70L3E0y5Q2vOmptyUGuwILedYkS1onV8/DfX0wwR0ZcXKt9gHlM EPYZNDotDDJRBWA5z6GGWZIBUsjQ+lJGaqgGb4K3hF0o0Cuk28x4eIL/r1UhNn9bgofw l5YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712934669; x=1713539469; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=umYWg6DJW6vGydBITxbBeNK9gyCVaIMoQCthI2KA6Yo=; b=kOL3nBinwiJul9O8mKwcZAYMw7otImpyYxsage3MZ8Viu9YV/RjH3r+tHswhdujFqb G5Q5EN8Wn+HylwbfAyfRaf/6KPN66YjTu0N7Ui0WMvA2OIGmoJVQBsxnMvHUPaMWdQB1 pG2qgGk1gGNAUYdzeMb9xb5zhhPSllyNT6NCUgsV7Tsfk6kIB6woQmLHgbgHoK1e/M5K xL+g6UHK54LsCHBjeWCInrcRXueaPtzJYAkrtnWtCB5PP5lEkIDAHNFHdxvtExcBH19Y fHKqSuQUMoAuuBvE6a8lDHRuHgmQGjUhmKX9GzSG/co+7r5Kz/FAO+Qm6c75AL/HsGOr EusA== X-Forwarded-Encrypted: i=1; AJvYcCVJALYKcVmp57ewwbOBbX5O3y+zhI7EeUvafHxvruFoSkPTqIPuxODZb73Yw5Ks6Z2hdut4W29IftqldvdyAeK02aafyCYzSOXDc7Lb X-Gm-Message-State: AOJu0Yxw8fF41oxPnPNYiF8EK5oSVpVnetXiks7POZDYM0ACzdcA2MCn JZ0RUp4GrzKRySwn0p5AdIc/Tw4PN0XOZyJ/7Bj99LpgKZZ11a0b5SNZjPrwCWI= X-Received: by 2002:a05:6870:f10e:b0:22e:cd76:9cc3 with SMTP id k14-20020a056870f10e00b0022ecd769cc3mr3344623oac.29.1712934669537; Fri, 12 Apr 2024 08:11:09 -0700 (PDT) Received: from localhost (2603-7000-0c01-2716-da5e-d3ff-fee7-26e7.res6.spectrum.com. [2603:7000:c01:2716:da5e:d3ff:fee7:26e7]) by smtp.gmail.com with ESMTPSA id r10-20020ac85e8a000000b004347d76f43csm2317757qtx.79.2024.04.12.08.11.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 08:11:08 -0700 (PDT) Date: Fri, 12 Apr 2024 11:11:04 -0400 From: Johannes Weiner To: Baolin Wang Cc: akpm@linux-foundation.org, mgorman@techsingularity.net, vbabka@suse.cz, 21cnbao@gmail.com, ryan.roberts@arm.com, david@redhat.com, ying.huang@intel.com, ziy@nvidia.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: page_alloc: allowing mTHP compaction to capture the freed page directly Message-ID: <20240412151104.GA2955562@cmpxchg.org> References: <8118a5d66a034736a48433beddaca60ed78577c4.1712892329.git.baolin.wang@linux.alibaba.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8118a5d66a034736a48433beddaca60ed78577c4.1712892329.git.baolin.wang@linux.alibaba.com> On Fri, Apr 12, 2024 at 11:27:04AM +0800, Baolin Wang wrote: > Currently, compaction_capture() does not allow lower-order allocations to > directly capture the movable free pages, even though lower-order allocations > might also be requesting movable pages, that can lead to more compaction > scanning. And, with the enablement of mTHP, such situations will become more > common. > > Thus allowing lower-order (mTHP) allocations of movable page types directly > capture the movable free pages can avoid unnecessary compaction scanning, > meanwhile that won't pollute the movable pageblock. With testing 1M mTHP > compaction, it can be seen that compaction scanning is significantly reduced. > > mm-unstable patched > Ops Compaction pages isolated 116598741.00 120946702.00 > Ops Compaction migrate scanned 1764870054.00 1488621550.00 > Ops Compaction free scanned 7707879039.00 4986299318.00 > Ops Compact scan efficiency 22.90 29.85 > Ops Compaction cost 73797.69 72933.48 > > Signed-off-by: Baolin Wang Letting a movable request into a partially compacted movable block seems reasonable. The only advantage of not doing so that I could imagine would be to avoid mixing old with new pages, such that reclaim is more likely to free blocks due to improved LRU grouping. But that seems far-fetched. Notably, __compact_finished() will also stop once the requested MOVABLE order becomes available; so not capturing at that point likely just results in stolen work and compaction restarts. Acked-by: Johannes Weiner