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 DC361C25B74 for ; Mon, 13 May 2024 19:04:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 52D9B6B0250; Mon, 13 May 2024 15:04:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4DD346B0251; Mon, 13 May 2024 15:04:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3A5BA6B0253; Mon, 13 May 2024 15:04:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 1E20B6B0250 for ; Mon, 13 May 2024 15:04:10 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 46665120FAA for ; Mon, 13 May 2024 19:04:09 +0000 (UTC) X-FDA: 82114297818.17.01B1236 Received: from mail-qt1-f177.google.com (mail-qt1-f177.google.com [209.85.160.177]) by imf21.hostedemail.com (Postfix) with ESMTP id 177E41C0024 for ; Mon, 13 May 2024 19:04:06 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=cgvik0LW; spf=pass (imf21.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.160.177 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1715627047; 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=drMW1Rvo4MuRn1Lfhy57d4TZ2XCivd8Q9I2KUmulD74=; b=tiMI1JaQA+T9xHDpXxuLQNKQyxHrqYEY0bfCYCREIXDhkxEB0a8dL82902k2d/gVW4Zxko WzQrYzBnOVfIuXDINkMOlLdcvY1Q+Qct7ePaPqk3OrS4tIHN/rqAb0/0dGhVLPpnl+1J3a n/VNsPPYchUV7nMiUFIdd2TdCcbhg3U= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=cgvik0LW; spf=pass (imf21.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.160.177 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1715627047; a=rsa-sha256; cv=none; b=M6KDvgwoY6wCpVvLUPV2l9XLljxBoHoHJ68clCgKf73ZtpMyCHgS4PL4hQtkOlio5DQe9N h1LS7PDGBUVjA2u+kVqF+UqqVRe2ZZh5I1ny6cPU+QIkYreyp1izzbiv09erYYP1QPDayk wADm75Ny6qTGynrDoimyTPY8k7s9xZE= Received: by mail-qt1-f177.google.com with SMTP id d75a77b69052e-43e1e98aaf0so4992531cf.2 for ; Mon, 13 May 2024 12:04:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1715627046; x=1716231846; darn=kvack.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=drMW1Rvo4MuRn1Lfhy57d4TZ2XCivd8Q9I2KUmulD74=; b=cgvik0LWxecGSlTwsXHlTrbYSYd+4In0jBgQCzD0gCjZWtDT5QbEHxGoHJDjHgiUPO 9fh5Za5s3YIjln4akvg5NWsNBncgv+QSJADosuX9sMgKUsdM5KNK5ZGitN+YBx+cj9oP SwX72E2S8ZytFgYMdwy8tN4J4efSnbJa/Os6pZf2U/TM4ST9CRSavtJNyJaXWb+/qHaX KDU/EUwUXyHLOnmPBGCTLpv0hEwDLWSr6qVgJB5l0rR+VgCs2cnVm/Mok6ugeeLaRPFE Y45ETPu3IHxdOn9oY2y/t64Q2Xs48veJ2xwMtc3u1FN0cINVUAfCE4bQ7sNyeZ6uTuTO ryMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715627046; x=1716231846; h=in-reply-to:content-transfer-encoding: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=drMW1Rvo4MuRn1Lfhy57d4TZ2XCivd8Q9I2KUmulD74=; b=IhzMwzJM7F58W2c/EWRqJKIS0klmi8oD8TyeWoAM+6HQG3DfmCJkzZW8hBJ0bKNWdr hX8FtJJY3vlbPkj+bBNEJ3d+Hn+4JtPmIRgXoFwWeU3q0osbGlMgkVoMjDA+Vafw0cid 8gNa3CUwMO0COzuYgf1MUyyWGPe1yStu1AejbnmPm8DvIoHLnmfXxsbX3mr5hvQJyNFk gJ32WwC64ZmRrc4fzxS6Je+9cCFRswiWJu93ewpNDeCDscX8OJAsfLMKPyEQ8acHDyjW 0n40bcANo8BdcIrFM1B8/qZQGVlerfCI1HRnd55i7vNnXA0Ps/PCaxBWeLH2ItaC6YEO mUgA== X-Forwarded-Encrypted: i=1; AJvYcCX7fDNXtuwnjeMvGVeO4os85az79myPl/9xkH+hLKyd25SKoDccsEetaA+tDmT3lPVqe+efnt12AfZeh1FGVHPgn68= X-Gm-Message-State: AOJu0YxL3ExQfEHC2olzSmkqt1c5tlYdqeAD33W1u9zTpf/BkMUJ6ggK peKyuuBSeo/npo0UWvTP7r1P9+AmJ75g9zpNq4+EqkScbyNAdcHF3YY2wxa1Jeg= X-Google-Smtp-Source: AGHT+IEunh2dcp1cZ5uxQ2yBrWkYWT2OqJsI9TTKMv+F7V69dqBz4GriLD3T7C3jhUQlM92IwHdipA== X-Received: by 2002:a05:622a:1354:b0:43e:1a17:10f9 with SMTP id d75a77b69052e-43e1a1746a4mr39523081cf.52.1715627045895; Mon, 13 May 2024 12:04:05 -0700 (PDT) Received: from localhost ([2603:7000:c01:2716:da5e:d3ff:fee7:26e7]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-43e0daba775sm28888361cf.63.2024.05.13.12.04.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 12:04:05 -0700 (PDT) Date: Mon, 13 May 2024 15:04:00 -0400 From: Johannes Weiner To: Yu Zhao Cc: Andrew Morton , Vlastimil Babka , Mel Gorman , Zi Yan , "Huang, Ying" , David Hildenbrand , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Kalesh Singh , Chun-Tse Shao Subject: Re: [PATCH V4 00/10] mm: page_alloc: freelist migratetype hygiene Message-ID: <20240513190400.GA2270702@cmpxchg.org> References: <20240320180429.678181-1-hannes@cmpxchg.org> <20240513160331.GA320190@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 177E41C0024 X-Stat-Signature: 6p8p4dmdwuq6gzhsirqk4cwkua4cbjts X-HE-Tag: 1715627046-836087 X-HE-Meta: U2FsdGVkX1/PE77KS65skvPbMey552Qg9rRyk8/BGXTdOuORiPQuzACEfLrP7EtnXikJ2YpcWUNYYndQOIsXhnTSt76kXlTH8doVZK6Swb288Hk51tIEAHd8gRmnOLtf0bsAi1HDbmbXe0f3BYeOSR55siXmzBru1mPnaW5MYti+x3W0+QoHoZrTif8SU/O4d6dvH3EfwXKkDV7fPNT+EbjNYHA5LAj92CwmWmBDAsdPwdrPFTaA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9tY0AQq9WcwK09xwzQVrDDcRsQDLo3QCc5oSBrXHzzmu4bmMScHJpHf+ieeEkd4Di7BrwIPyTiZPtaa9JqRwyNfDZALubpIgLr68jHkRuDfliDMbtrRQJos27zvjde86e+6VjD9lWIXo97OlAL3O4N4faVbuqhxgWH+3dYxDY/sbB9CPlZKfrOPkC7QZfgekRDfRkvKlwxt5DrCP9W6qxhLW/yYS5fdncGNSyxGiOY/B64cTP4rwvVsflw9PoiD0r49uRFGz/H6Mjsw== 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, May 13, 2024 at 12:10:04PM -0600, Yu Zhao wrote: > On Mon, May 13, 2024 at 10:03 AM Johannes Weiner wrote: > > > > On Fri, May 10, 2024 at 11:14:43PM -0600, Yu Zhao wrote: > > > On Wed, Mar 20, 2024 at 12:04 PM Johannes Weiner wrote: > > > > > > > > V4: > > > > - fixed !pcp_order_allowed() case in free_unref_folios() > > > > - reworded the patch 0 changelog a bit for the git log > > > > - rebased to mm-everything-2024-03-19-23-01 > > > > - runtime-tested again with various CONFIG_DEBUG_FOOs enabled > > > > > > > > --- > > > > > > > > The page allocator's mobility grouping is intended to keep unmovable > > > > pages separate from reclaimable/compactable ones to allow on-demand > > > > defragmentation for higher-order allocations and huge pages. > > > > > > > > Currently, there are several places where accidental type mixing > > > > occurs: an allocation asks for a page of a certain migratetype and > > > > receives another. This ruins pageblocks for compaction, which in turn > > > > makes allocating huge pages more expensive and less reliable. > > > > > > > > The series addresses those causes. The last patch adds type checks on > > > > all freelist movements to prevent new violations being introduced. > > > > > > > > The benefits can be seen in a mixed workload that stresses the machine > > > > with a memcache-type workload and a kernel build job while > > > > periodically attempting to allocate batches of THP. The following data > > > > is aggregated over 50 consecutive defconfig builds: > > > > > > > > VANILLA PATCHED > > > > Hugealloc Time mean 165843.93 ( +0.00%) 113025.88 ( -31.85%) > > > > Hugealloc Time stddev 158957.35 ( +0.00%) 114716.07 ( -27.83%) > > > > Kbuild Real time 310.24 ( +0.00%) 300.73 ( -3.06%) > > > > Kbuild User time 1271.13 ( +0.00%) 1259.42 ( -0.92%) > > > > Kbuild System time 582.02 ( +0.00%) 559.79 ( -3.81%) > > > > THP fault alloc 30585.14 ( +0.00%) 40853.62 ( +33.57%) > > > > THP fault fallback 36626.46 ( +0.00%) 26357.62 ( -28.04%) > > > > THP fault fail rate % 54.49 ( +0.00%) 39.22 ( -27.53%) > > > > Pagealloc fallback 1328.00 ( +0.00%) 1.00 ( -99.85%) > > > > Pagealloc type mismatch 181009.50 ( +0.00%) 0.00 ( -100.00%) > > > > Direct compact stall 434.56 ( +0.00%) 257.66 ( -40.61%) > > > > Direct compact fail 421.70 ( +0.00%) 249.94 ( -40.63%) > > > > Direct compact success 12.86 ( +0.00%) 7.72 ( -37.09%) > > > > Direct compact success rate % 2.86 ( +0.00%) 2.82 ( -0.96%) > > > > Compact daemon scanned migrate 3370059.62 ( +0.00%) 3612054.76 ( +7.18%) > > > > Compact daemon scanned free 7718439.20 ( +0.00%) 5386385.02 ( -30.21%) > > > > Compact direct scanned migrate 309248.62 ( +0.00%) 176721.04 ( -42.85%) > > > > Compact direct scanned free 433582.84 ( +0.00%) 315727.66 ( -27.18%) > > > > Compact migrate scanned daemon % 91.20 ( +0.00%) 94.48 ( +3.56%) > > > > Compact free scanned daemon % 94.58 ( +0.00%) 94.42 ( -0.16%) > > > > Compact total migrate scanned 3679308.24 ( +0.00%) 3788775.80 ( +2.98%) > > > > Compact total free scanned 8152022.04 ( +0.00%) 5702112.68 ( -30.05%) > > > > Alloc stall 872.04 ( +0.00%) 5156.12 ( +490.71%) > > > > Pages kswapd scanned 510645.86 ( +0.00%) 3394.94 ( -99.33%) > > > > Pages kswapd reclaimed 134811.62 ( +0.00%) 2701.26 ( -98.00%) > > > > Pages direct scanned 99546.06 ( +0.00%) 376407.52 ( +278.12%) > > > > Pages direct reclaimed 62123.40 ( +0.00%) 289535.70 ( +366.06%) > > > > Pages total scanned 610191.92 ( +0.00%) 379802.46 ( -37.76%) > > > > Pages scanned kswapd % 76.36 ( +0.00%) 0.10 ( -98.58%) > > > > Swap out 12057.54 ( +0.00%) 15022.98 ( +24.59%) > > > > Swap in 209.16 ( +0.00%) 256.48 ( +22.52%) > > > > File refaults 17701.64 ( +0.00%) 11765.40 ( -33.53%) [...] > > > > > > This series significantly regresses Android and ChromeOS under memory > > > pressure. THPs are virtually nonexistent on client devices, and IIRC, > > > it was mentioned in the early discussions that potential regressions > > > for such a case are somewhat expected? > > > > This is not expected for the 10 patches here. You might be referring > > to the discussion around the huge page allocator series, which had > > fallback restrictions and many changes to reclaim and compaction. > > Right, now I remember. > > > Can you confirm that you were testing the latest patches that are in > > mm-stable as of today? There was a series of follow-up fixes. > > Here is what I have on top of 6.8.y, which I think includes all the > follow-up fixes. The performance delta was measured between 5 & 22. > > 1 mm: convert free_unref_page_list() to use folios > 2 mm: add free_unref_folios() > 3 mm: handle large folios in free_unref_folios() > 4 mm/page_alloc: remove unused fpi_flags in free_pages_prepare() > 5 mm: add alloc_contig_migrate_range allocation statistics > 6 mm: page_alloc: remove pcppage migratetype caching > 7 mm: page_alloc: optimize free_unref_folios() > 8 mm: page_alloc: fix up block types when merging compatible blocks > 9 mm: page_alloc: move free pages when converting block during isolation > 10 mm: page_alloc: fix move_freepages_block() range error > 11 mm: page_alloc: fix freelist movement during block conversion > 12 mm-page_alloc-fix-freelist-movement-during-block-conversion-fix > 13 mm: page_alloc: close migratetype race between freeing and stealing > 14 mm: page_alloc: set migratetype inside move_freepages() > 15 mm: page_isolation: prepare for hygienic freelists > 16 mm-page_isolation-prepare-for-hygienic-freelists-fix > 17 mm: page_alloc: consolidate free page accounting > 18 mm: page_alloc: consolidate free page accounting fix > 19 mm: page_alloc: consolidate free page accounting fix 2 > 20 mm: page_alloc: consolidate free page accounting fix 3 > 21 mm: page_alloc: change move_freepages() to __move_freepages_block() > 22 mm: page_alloc: batch vmstat updates in expand() It does look complete to me. Did you encounter any conflicts during the backport? Is there any chance you can fold the fixes into their respective main patches and bisect the sequence? Again, it's not expected behavior given the fairly conservative changes above. It sounds like a bug. > > Especially, please double check you have the follow-up fixes to > > compaction capturing and the CMA fallback policy. It sounds like the > > behavior Baolin described before the CMA fix. > > Yes, that one was included. Ok. > > Lastly, what's the base you backported this series to? > > It was 6.8, we can potentially try 6.9 this week and 6.10-rc in a few > weeks when it's in good shape for performance benchmarks. If you could try 6.9 as well, that would be great. I backported the series to 6.9 the other day (git cherry-picks from mm-stable) and I didn't encounter any conflicts. > > > On Android (ARMv8.2), app launch time regressed by about 7%; On > > > ChromeOS (Intel ADL), tab switch time regressed by about 8%. Also PSI > > > (full and some) on both platforms increased by over 20%. I could post > > > the details of the benchmarks and the metrics they measure, but I > > > doubt they would mean much to you. I did ask our test teams to save > > > extra kernel logs that might be more helpful, and I could forward them > > > to you. > > > > If the issue persists with the latest patches in -mm, a kernel config > > and snapshots of /proc/vmstat, /proc/pagetypeinfo, /proc/zoneinfo > > before/during/after the problematic behavior would be very helpful. > > Assuming all the fixes were included, do you want the logs from 6.8? > We have them available now. Yes, that would be helpful. If you have them, it would also be quite useful to have the vmstat before-after-test delta from a good kernel, for baseline comparison. Thanks