From patchwork Wed Mar 27 18:57:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Weiner X-Patchwork-Id: 13607293 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 831A9C47DD9 for ; Wed, 27 Mar 2024 18:57:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0F7986B0087; Wed, 27 Mar 2024 14:57:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0A7156B008A; Wed, 27 Mar 2024 14:57:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E8ABE6B008C; Wed, 27 Mar 2024 14:57:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id CAB3D6B0088 for ; Wed, 27 Mar 2024 14:57:44 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 92A1EA07C5 for ; Wed, 27 Mar 2024 18:57:44 +0000 (UTC) X-FDA: 81943728048.22.8CCC08E Received: from mail-qv1-f54.google.com (mail-qv1-f54.google.com [209.85.219.54]) by imf04.hostedemail.com (Postfix) with ESMTP id BE29340007 for ; Wed, 27 Mar 2024 18:57:42 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=u+wzBzgc; spf=pass (imf04.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.219.54 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=1711565863; 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:dkim-signature; bh=1l8LwEAqTqzUC45r7vgbxldnGKxvJq2VhJB7bphMGJc=; b=ca77mBUAeA4OYCTozDVFdp2SIUQ7TH2JAIe3V6G7P8TiiUMNNpgez6TGERfmlN3LlYKanP lUnirVuHiPAKljw1hLZH7DFBPLXS2nOFyG4x8sXmM/9Fbf8j7SlKynE3Q8D4c3FutXvOj1 KkPUnzKlJzWdYD8dEFe8Db9NW1mrZws= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711565863; a=rsa-sha256; cv=none; b=bHJGDwlD88Gj63Gm8HUKwWSKt09E4A3TSZX7IuIeT5Ymb5KpyIO3Ps3SqrjiGjX/Dhg76H DWYHT1UMhMvKRH81yvupL4hBqaHz/uurGAZrlestOOyn6jGSblM0hy6LVIk9ecte9UM1NF 4YexkgzseYhHOts/FiNOhRqZ2jP7/Is= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=u+wzBzgc; spf=pass (imf04.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.219.54 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org Received: by mail-qv1-f54.google.com with SMTP id 6a1803df08f44-696499bd61eso1639176d6.0 for ; Wed, 27 Mar 2024 11:57:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1711565862; x=1712170662; darn=kvack.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=1l8LwEAqTqzUC45r7vgbxldnGKxvJq2VhJB7bphMGJc=; b=u+wzBzgch/bel9ZmJIm+2wRhnF5f+vOUUrZ7tmst9++1UwnTRXS2+X6UOoRkSEu1Me HYF0q2jOLp1kGYN3+5Kke0pMjR2BkmT3fexI8C7nr6OHr40eQCgxkmLl/HfoRt/D5f6E hyJfROCQyUQw4wWpvbRuqaS2FZDp8abKm/Kv9Rnepc1csvlNZBC+kotVK0Bbr7hM1AJT 3hUkcl9ylCZ6FgrWCnRFRvdSDJ+SgCruRHnHdodhooTnhBeLxwU3a9XfJPPEWEBYcjuj OiR1QHx+ZHTk1hUdQy4ZYEix/U/oeCXazla5gMrsUbRJMBAtWRTbaG2PYWb9mbQZ8BHF Qt/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711565862; x=1712170662; 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=1l8LwEAqTqzUC45r7vgbxldnGKxvJq2VhJB7bphMGJc=; b=V8XWvjFRw5hn6yOX090SdYy7WEHYf1kcz4tF5it568cI4lP3haGqJi8SnHL8mx6LA5 PpALkzlbgxAyQcImdg2P2fAxv6LhXgeT/dxUdBoKTXmP6OdrY1Sev1PtZDzbg3ePazrx 68J9AiBclipwD3aQhfybhY1LpWXYOS6eoTJh40cBvJHPGWl6eFwC11vYhaIghs1n2xFO hnnnQgaYfXychB8GcV2FQy7l5PC5LfYETcofG4sxl0LBMUxnMX3kjXjlXDqk8xN/r48y CdawO1krq89MW8K4h/utqavt9jMDT5i6MIcqIksd0Q5caf8yz+9vZLtwM4YUBKCUn//8 GSJg== X-Forwarded-Encrypted: i=1; AJvYcCWKI1kLoOtiX9fgKWF/Hn8T0OD4+PKNGQdvhfdCbSJIdQhIFqbvLfLkLkgzGC59bHojqOQgyLYuF1nbVX9ogsg4KdY= X-Gm-Message-State: AOJu0Yw1CXXkFjTxe00rWwLVleKstk8zEDB1oNvuEqt3sdsd2HCu/ezt 35vvi4Uv2tXBeE+jacUV3ZLx2m4tLWBdSe+N6c1WYk6LhYnmZ5HRgFKap3wD/Qkqw5wzvdtEWXa 8 X-Google-Smtp-Source: AGHT+IEN8/WSSGf+HicRD3a4NBcuHxxIchLwLgRERsJP0K+obubQTmVi3qnRCMwz70vMLWE9Bgcvgw== X-Received: by 2002:a05:6214:519b:b0:691:57c4:b918 with SMTP id kl27-20020a056214519b00b0069157c4b918mr461268qvb.37.1711565861450; Wed, 27 Mar 2024 11:57:41 -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 fo15-20020ad45f0f000000b0069680284380sm4737449qvb.56.2024.03.27.11.57.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 11:57:41 -0700 (PDT) Date: Wed, 27 Mar 2024 14:57:36 -0400 From: Johannes Weiner To: Vlastimil Babka Cc: Andrew Morton , Mel Gorman , Zi Yan , "Huang, Ying" , David Hildenbrand , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] mm: page_alloc: consolidate free page accounting fix Message-ID: <20240327185736.GA7597@cmpxchg.org> References: <20240320180429.678181-1-hannes@cmpxchg.org> <20240320180429.678181-11-hannes@cmpxchg.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Stat-Signature: 8hpt6ga918eas8m5j7a995ancpwfb5s6 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: BE29340007 X-Rspam-User: X-HE-Tag: 1711565862-694484 X-HE-Meta: U2FsdGVkX1/R3R3LF266zCQoeDpnOHgZAATzcrYS/AoU+Hqp4inwOa7CyoJSsw/ky3OYYpNwdr2Ej2ft/qFn+prz5BPpcsaEDVJ8SkhUoTvpNV8GDtnivO1kWFQFY5AklZYvNa3XKl3lDxdHAmBJb3CqF0Z/zwX72qA8WoBsCuAhVybqO1eiIR60RwT+CXgE0rB5hmbIKcZvq2TFZggDG64msZByJGi6vY775/pTfhRmw4WlwPx1GXeg2dw+EPnNY8yjjbJITrLQIJIZCp7+qmgaDH6xS0co1kULPKDoA6Tg2Ht6tYA9sGXyj6upOpixc3ktHcLFgh5Gygufw2TSvfBOR03bytZv/lpSx8fbvGVQ6njqi7JBuWc71sLsTVZen/ZTZ9bV5WrZSOJYU80dNh2dx/eTkexJ9cW78yBAbueAYVpllEWl7hMuKzl+7xuMKdZTVXzIKy7Octwh/LTvTHdsAsU0VaMJrEvhVsDn/UsrrY98S5HtzcMJfOIIOr9AB957ydEYLEACajrJvDa+9HbtR57cNok5i5SwUspVSKG5mogPZe+F12CvTqdFDUpZkPsaL8Sm0JgQXoqBiuP76rlJKXUQvIDAGiPc3Ce7f3fddD6MZ/fwVgxxW6guu7Gwigs4PwiTh00cEOIm2xWsGZjDEdzfo7q78qaFZgT14OAcNOtJfXZOalgvOqQ9hJ65j1yTrVFHhauJTzioeccwj9itwK4XwphVnBKqPR2QuthgHll/GnK32Y+LK+un/zIsG0bKqWxXCKGI84+XYb30P3yg74ZXL55Y17ww74BpGpo/pii7KoTLbcXs6/Jld9NHDLPqEIH9VPcepyhMKDPd1EbUsP7lajt7xUBgwtmf+vgvaUza7TuBBlAUOCsoap0AQbojw9KUYXXdFQzTzzYdQyZ1tG74dj0Lz+EBI4NNpxUgP01Ud3gSrn6aSWiiARiPqdGA6rln6CgCDbw6DpO 2Z4rUK/U 68SM5XR5PCTBrJeoEWoKZrvVCES0OvfHfRvzbjPBwPMmc/Q/TgReEfJABO/6rd7nH2diGLcaq3YDZBEw0Cyz/0wRZP9+BVuM7oRbXmCuhYYh6G5MGb7gXq5UhqUhEm0zg6aq8SaBV3H1umpGlYZEXN0yX++2fCezD5/ZG30YDTh8QAaR4Kh5UNaP6cA== 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 Wed, Mar 27, 2024 at 09:54:01AM +0100, Vlastimil Babka wrote: > > @@ -252,7 +252,8 @@ static void unset_migratetype_isolate(struct page *page, int migratetype) > > * Isolating this block already succeeded, so this > > * should not fail on zone boundaries. > > */ > > - WARN_ON_ONCE(!move_freepages_block_isolate(zone, page, migratetype)); > > + WARN_ON_ONCE(!move_freepages_block_isolate(zone, page, > > + migratetype)); > > } else { > > set_pageblock_migratetype(page, migratetype); > > __putback_isolated_page(page, order, migratetype); > > Looks like a drive-by edit of an extra file just to adjust identation. Andrew, can you please fold the following fixlet? From fa8dae0b39c5acfd4c0035c5a25b706b3a105497 Mon Sep 17 00:00:00 2001 From: Johannes Weiner Date: Wed, 27 Mar 2024 12:19:17 -0400 Subject: [PATCH 1/3] mm: page_alloc: consolidate free page accounting fix undo unrelated drive-by line wrap Signed-off-by: Johannes Weiner --- mm/page_isolation.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mm/page_isolation.c b/mm/page_isolation.c index 914a71c580d8..042937d5abe4 100644 --- a/mm/page_isolation.c +++ b/mm/page_isolation.c @@ -252,8 +252,7 @@ static void unset_migratetype_isolate(struct page *page, int migratetype) * Isolating this block already succeeded, so this * should not fail on zone boundaries. */ - WARN_ON_ONCE(!move_freepages_block_isolate(zone, page, - migratetype)); + WARN_ON_ONCE(!move_freepages_block_isolate(zone, page, migratetype)); } else { set_pageblock_migratetype(page, migratetype); __putback_isolated_page(page, order, migratetype); From patchwork Wed Mar 27 18:58:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Weiner X-Patchwork-Id: 13607294 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 AFA17C54E67 for ; Wed, 27 Mar 2024 18:58:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 27DE56B008C; Wed, 27 Mar 2024 14:58:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 22E6E6B0092; Wed, 27 Mar 2024 14:58:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0CF166B0095; Wed, 27 Mar 2024 14:58:36 -0400 (EDT) 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 E1D7A6B008C for ; Wed, 27 Mar 2024 14:58:35 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 5574E1C0ABB for ; Wed, 27 Mar 2024 18:58:35 +0000 (UTC) X-FDA: 81943730190.15.08E03B9 Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.169]) by imf12.hostedemail.com (Postfix) with ESMTP id 73C8840004 for ; Wed, 27 Mar 2024 18:58:33 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=nKA9qUPt; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf12.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.222.169 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711565913; 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:dkim-signature; bh=5+6/z6Iu03sZnSDjOG6ZOICRhEOxeVPmVmqIOYHqAQQ=; b=1YBpdhKCj30rcV3HMys0LjApfBz34J47+2ySns+LwGWWP/5Im8acPYe01UnUmr2S4rDbiK /NEZJ4GTRwhiPJCBwof9kTgyleSfgFClOUbw0Zygq9VCTf+ktXZsbhx9PlBuyKJ/WdPHUd 1Gg8eJeRC217Y6JqpEsiu+squFt+KAE= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=nKA9qUPt; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf12.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.222.169 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711565913; a=rsa-sha256; cv=none; b=vsDufAO2+IAdS8Wh3s590HRFQWndDdHRjrFE4fsB3xlc24lS8BTm+UBctvJr+qiS8n+yhK Pqu1BzY1L4EtPy0Qy4YludB/0d2nZpluqA/a7l6kp65DVMBHFuKM3MTkwlE5j1Ahrutp9Z ZwixIBYLIVMrsy/MOrSsk/ykxMpmbRw= Received: by mail-qk1-f169.google.com with SMTP id af79cd13be357-789ddcd57f4so5475885a.2 for ; Wed, 27 Mar 2024 11:58:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1711565912; x=1712170712; darn=kvack.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=5+6/z6Iu03sZnSDjOG6ZOICRhEOxeVPmVmqIOYHqAQQ=; b=nKA9qUPtMdA0Ms2SZe+THwvo3FyTjZbKdr3XXf/D/Xt0S1ymJ5OJjhhD5w9WhUkvMU Oaiv1wnDeWa6VdKPaG6Qg/9aMi8UG1aD63VFfH6nv3q/sDTlaKTqNPcqhzHge5Dl86aZ HMHKtiJf2cEt+pu9HKjw5cwWTUbQXctyvFHJJ8L/+LnfY0Vf8hXZvbB7ZMVZzW+DkPFE 7g0hOdEi6oaVBRiNWBgQ4DAay73GHc4TBqntjqmjCnP438UECWB7MznZ2m201bzGx/eZ pAebOTjbRv7IoDGCF6VpcNDZRkC4GAOL8hULhalX8hPsZkmfECElsku9NGtWBXUbs+jk oFCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711565912; x=1712170712; 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=5+6/z6Iu03sZnSDjOG6ZOICRhEOxeVPmVmqIOYHqAQQ=; b=WdSXyMoZySNsI0uTZH4K9sVBRbkofZw/G+3iwi75t4nhGxjnnZpLOxzF+wPu+EBHug mXYi8FD3mIkJVVsuTMafWlaA+gO326gE2ZvX6ZCTjCMtC77Mu5fm3URhwnrPyNfzQjP9 2nOtlnUKF7XyDQOAbdRFjOnE0ABBgiYIpDW0r3hFmoxco/63HdwHmztXiFZ6Szmao+UP ah8xTwjBHElPmVvK0Q0GwGNTynGXFYFmEKkpIOCl+KEin7BiIyMR/j+jlkcJydWvZxjB bSil5azo/BqJIYcuXrHageKEYctaZfK4lipQ8P1n5Lclyp573Wk4ecu36EwI6rU2cFxt P56w== X-Forwarded-Encrypted: i=1; AJvYcCUO+H/k8+zeN96YMHsY+sHp8FprMzwtoW0O2dc4hkfNo0pMLLiytFsOaT3RuV6UaB2JL4+lyuvXdJ8lBEd5O7Wqo1Y= X-Gm-Message-State: AOJu0Yz890leb7vZXB/iJUtxiAxNdXQpUO444/ZohPBGqRwOiUZaGnYT /ujGESpHo/+07dvWO36BAixmXmlurNEUXSeGeQ9HOA4HjOK4KRML0Pvc6QbzfZg= X-Google-Smtp-Source: AGHT+IFMX86LnLj/Jckkj0IDbpKUIbE2+GQj4be5JSr0OrjfUwBsujcYelDxsMjtbJtNCeNV8Jvubg== X-Received: by 2002:a05:620a:44c4:b0:789:eeb7:2273 with SMTP id y4-20020a05620a44c400b00789eeb72273mr480031qkp.49.1711565912546; Wed, 27 Mar 2024 11:58:32 -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 cx7-20020a05620a51c700b007884a54ffb1sm4077907qkb.135.2024.03.27.11.58.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 11:58:32 -0700 (PDT) Date: Wed, 27 Mar 2024 14:58:31 -0400 From: Johannes Weiner To: Vlastimil Babka Cc: Andrew Morton , Mel Gorman , Zi Yan , "Huang, Ying" , David Hildenbrand , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] mm: page_alloc: consolidate free page accounting fix 2 Message-ID: <20240327185831.GB7597@cmpxchg.org> References: <20240320180429.678181-1-hannes@cmpxchg.org> <20240320180429.678181-11-hannes@cmpxchg.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Rspam-User: X-Stat-Signature: hibe8d7pu9syuaqudb6zh7msq46q8ipb X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 73C8840004 X-HE-Tag: 1711565913-287232 X-HE-Meta: U2FsdGVkX1+0G0Fcr2OlS04h3BCVr2Qudz00TUs7YqeLu7+Rzg+Iq86Na7i65NPV8+DHY1e7utpUfv4DsIJ0C4wQ7DAhiY7QgaoqRhvkKJqk8g8k6eKL2tmLtsVrvezByqJKqAcB3GO44C4HgHFhYiRqMzb8G6bL+xjKm3qW2hwKjYFvFOn11n3noNBAeZ3ionBOlzfa8m5BO6FuB2RSzsivN7q1VI1Lx1EHzEBJHNAI8tyTbh85DHWgHppi/0a/f5StGV8hhkTCqwPX1KAQf7eJqxD3be9ZooGHr7imhd6XRbgHUCw29saY3PxggGXCa8iqioZOj1m7A3DKhWgL+vKPv/Q04w90rORDIwqg/PezG9iQj7BJfF2yK/rLdOteC4Ygd7XmaGqAwXBBWsqjihA67q2JwV2Vf3odnVoaInEFKsh07VYnHLe0KEbSe74zpbtAAR5t03whZJYSFmIrQA9YMwF/VzmL3IhibQGZMp42+5a4KZ5kwkraiifSsrEGpUBdIazTeP8oqhMe7/q6tsFe3ZEUbkcOAX9ZF/kMZlpYoVSlfAaMduXSvLtBbz83E64AWv15DXCN0Ljb7as9Nrd/DGD9k/yzHMok1GwrDTKKMKWw1DqkEtMhgZAGgD0uEd4B34QiW5LtFpkTqW/drwJB5M+bb9OzaR44Csir1INjhWijO2TpatOvEBBl+64uULOa32qo9FgUjuzWuEYxpmn6aUUp/kqlirQuwQwjGZP7upVqz+aAvCWpt9HevLqfSBzxXtAU0k9YlAYMeQ0Qx1zk0ywLQZB+sHkn8WvCnTecjD0JIvaixHX3seQHK3Wfs0zu2iBxWoOJHmQ8gCve0lWzr7JrFRdt0ZiK8L/Cg8qIUInBs1WSOo7JtHgjPWfPqYK+Hy+0eXYBE+h15i/nCJEaJgkRSOxLqphfSi0t5jRm+H8Hljk3Luslw+wezC3bNSKs8aOoqat7pspGAzN NRfG/6em 4zZMIrWaXpOrwFetl94SIqCcyGyEkkAGtaMvPTSYok6HOrrWQjNBb8dlSHN+Ul9UM3AchVkm7Han4d7vsP1igkKckkY9mbdELvCfNqTmx8PouIe+IwGY0nJ110sS8qH2RAX3gvo4dIcGBFxbjQ3Xi7GbrlwfoHeMDae8C7QUR3onCwDoKih67bUw75Byyn6AnR4Mv6FQ9O7/MLmnQp9QZTzaIrURqZY6UPtEWdSzJWAaZSUig+JcMr2xzeG3hoIHxmg5MULUjsNGp6uFzv7vus5mCeZIn+zxBJm11zEpP8Ja0xGR1vDG2KvZP0cyzInMehZfwaST7yrJrgLm0jKvdZv7GIyTIF1u8Ds9e8ZRnHZxQrKtdKvyfTMpUdezT3Vo0A95unDn52CfqIPKIcZWHYo5zH0jYMiZMe8bF9v2OrvVtrCN6ntQye0j4wriFApcASMiwQ2psNdd79T+7fV0pvCvaJWsWntF8qaZAMz2xOXuJXfrYhcRPZICyGl/5POYOKCqk 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: From d3a0b6847f8bf1ecfa6b08c758dfa5a86cfb18b8 Mon Sep 17 00:00:00 2001 From: Johannes Weiner Date: Wed, 27 Mar 2024 12:28:41 -0400 Subject: [PATCH 2/3] mm: page_alloc: consolidate free page accounting fix 2 remove unused page parameter from account_freepages() Signed-off-by: Johannes Weiner --- mm/page_alloc.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 34c84ef16b66..8987e8869f6d 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -643,8 +643,8 @@ compaction_capture(struct capture_control *capc, struct page *page, } #endif /* CONFIG_COMPACTION */ -static inline void account_freepages(struct page *page, struct zone *zone, - int nr_pages, int migratetype) +static inline void account_freepages(struct zone *zone, int nr_pages, + int migratetype) { if (is_migrate_isolate(migratetype)) return; @@ -678,7 +678,7 @@ static inline void add_to_free_list(struct page *page, struct zone *zone, bool tail) { __add_to_free_list(page, zone, order, migratetype, tail); - account_freepages(page, zone, 1 << order, migratetype); + account_freepages(zone, 1 << order, migratetype); } /* @@ -698,8 +698,8 @@ static inline void move_to_free_list(struct page *page, struct zone *zone, list_move_tail(&page->buddy_list, &area->free_list[new_mt]); - account_freepages(page, zone, -(1 << order), old_mt); - account_freepages(page, zone, 1 << order, new_mt); + account_freepages(zone, -(1 << order), old_mt); + account_freepages(zone, 1 << order, new_mt); } static inline void __del_page_from_free_list(struct page *page, struct zone *zone, @@ -723,7 +723,7 @@ static inline void del_page_from_free_list(struct page *page, struct zone *zone, unsigned int order, int migratetype) { __del_page_from_free_list(page, zone, order, migratetype); - account_freepages(page, zone, -(1 << order), migratetype); + account_freepages(zone, -(1 << order), migratetype); } static inline struct page *get_page_from_free_area(struct free_area *area, @@ -800,7 +800,7 @@ static inline void __free_one_page(struct page *page, VM_BUG_ON_PAGE(pfn & ((1 << order) - 1), page); VM_BUG_ON_PAGE(bad_range(zone, page), page); - account_freepages(page, zone, 1 << order, migratetype); + account_freepages(zone, 1 << order, migratetype); while (order < MAX_PAGE_ORDER) { int buddy_mt = migratetype; @@ -6930,7 +6930,7 @@ static bool try_to_accept_memory_one(struct zone *zone) list_del(&page->lru); last = list_empty(&zone->unaccepted_pages); - account_freepages(page, zone, -MAX_ORDER_NR_PAGES, MIGRATE_MOVABLE); + account_freepages(zone, -MAX_ORDER_NR_PAGES, MIGRATE_MOVABLE); __mod_zone_page_state(zone, NR_UNACCEPTED, -MAX_ORDER_NR_PAGES); spin_unlock_irqrestore(&zone->lock, flags); @@ -6982,7 +6982,7 @@ static bool __free_unaccepted(struct page *page) spin_lock_irqsave(&zone->lock, flags); first = list_empty(&zone->unaccepted_pages); list_add_tail(&page->lru, &zone->unaccepted_pages); - account_freepages(page, zone, MAX_ORDER_NR_PAGES, MIGRATE_MOVABLE); + account_freepages(zone, MAX_ORDER_NR_PAGES, MIGRATE_MOVABLE); __mod_zone_page_state(zone, NR_UNACCEPTED, MAX_ORDER_NR_PAGES); spin_unlock_irqrestore(&zone->lock, flags); From patchwork Wed Mar 27 19:01:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Weiner X-Patchwork-Id: 13607295 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 5FD51C47DD9 for ; Wed, 27 Mar 2024 19:01:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DA3BF6B0098; Wed, 27 Mar 2024 15:01:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D54456B0099; Wed, 27 Mar 2024 15:01:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C1C096B009A; Wed, 27 Mar 2024 15:01:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id A3B836B0098 for ; Wed, 27 Mar 2024 15:01:16 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 5CC4B120756 for ; Wed, 27 Mar 2024 19:01:16 +0000 (UTC) X-FDA: 81943736952.14.9060128 Received: from mail-qv1-f54.google.com (mail-qv1-f54.google.com [209.85.219.54]) by imf21.hostedemail.com (Postfix) with ESMTP id 2D2361C0022 for ; Wed, 27 Mar 2024 19:01:13 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=dvov4tee; spf=pass (imf21.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.219.54 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=1711566074; 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:dkim-signature; bh=8GxQ/m2i2KHb6JEyfIRJnzrg7z0UGo5xSQekII3ANKE=; b=B3l2v+0Z7qx9YfKRO/vHOvJSN5Y6yiB9MOwWhzt84hIvWGKwJhjuqTg8vHSmE1YmojlKMT rtEkmkQZRPWPzX9ljp0QeOndj0p4zpTXITVMx1UPpEdpoeKFqjblmix+uEKxDvauQlstsv GNe1KXDi1w6701HmkLZP7Fd5kQqe6W0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711566074; a=rsa-sha256; cv=none; b=6nqj2LYWrEU1/3uivd2H567NkzkzgeEMxdBm6wB6YttAfnBditbOGTFcqUBpvSDVRhJKLg WOI5yUpvEk2S3t9xbw9/r/f1du2m4dGDLF+0SGCOQ94J8i5Fw0Npbt63AsC7xItFsC5yjJ KpbXNG9J5Y7Cv73RyEKb2fib4T5hPrs= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=dvov4tee; spf=pass (imf21.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.219.54 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org Received: by mail-qv1-f54.google.com with SMTP id 6a1803df08f44-69625f89aa2so1479236d6.3 for ; Wed, 27 Mar 2024 12:01:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1711566073; x=1712170873; darn=kvack.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=8GxQ/m2i2KHb6JEyfIRJnzrg7z0UGo5xSQekII3ANKE=; b=dvov4teeaC0DFW1ykntLV1zK+SHQh8WwCNjb/EHeVxlZQCG8QwYFZR0rKHUCCfJr6z xDZ77+lY6DJmmvyZ1cJDGjcrCZbOCeURQcc+8YB0U+YOiXcxn88yHk/wivLGOQUMfkUa HW0zcwY2P6iArlmfLHpPaBPWo0cuEbWtoyARkjDNe1rIAsMkMINC8iF6HG4jVz/AKQDg B+sgYIJv9uafZe4JXIpWag8Xf6ycBw/fT7J9HEx807z+slk0xi5+xAf2hFp3feYLBUqA fQeP6i/55rAUz/jj9mwUseH6uSfGRNnaI/bkiZFE5d+Ubtbr55Ptw7vI/d7Dx9iVS2DM iDAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711566073; x=1712170873; 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=8GxQ/m2i2KHb6JEyfIRJnzrg7z0UGo5xSQekII3ANKE=; b=Q3yTrA48P/wu509NT+uvrWmX6Qne1O/I3SqLxpIYfURmnEMNqXgJ0qsklLtA9nwtoz CI9Id2Dy6Yk6taZ3YEY2q53sHoWxHzKE/y6vUcJ8jAWw3Lce9H9aoSgO74KUVrYhXJl6 LfYl/Z+zmV7DS75fANUuKgrchS0jFqS5pxFJVchSsj93+Qmx0D+rY1uDfvURhtZvWG7V 6TC8w6sYvVzr4YrgdD8uoXYbKocCUjc4NR+pK0k1QomUMzY6wXb2Ts6dlUg1fiEh8mWZ ikdQ1Yk27hfWPJbVtPaFiXMlDXC4bAcscQi2bEUiiW9MeOIIrllg6bF+SnGTffLg0IiY YCcA== X-Forwarded-Encrypted: i=1; AJvYcCX9Le/B+oBbgOU1MY335hlNxXERROFTwJ2J+yq6VJFSUhCB5bto6EuHDUEwoae/eVCTXS2Hw1YA4p67jd2QQo3/GBw= X-Gm-Message-State: AOJu0YzWdzYZJMSUOnDkS08766piNrVkh26oC3v76AGtj805D5uZPlBU ON4M1OkQqCJYPQ0CYU81dXUPtEzjy1LUM+uCsO+hhPtxF7b50GAqrKWhKdhsv7A= X-Google-Smtp-Source: AGHT+IEMWc0z3NWlQR8No9ANDoskQvZ+0Bj532IQLCTNjDCCjXJTlv4aoJ+acHAsX68VVMDqZgNiCg== X-Received: by 2002:a0c:f085:0:b0:690:734e:50c9 with SMTP id g5-20020a0cf085000000b00690734e50c9mr540594qvk.24.1711566073038; Wed, 27 Mar 2024 12:01:13 -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 2-20020a0562140d6200b0069778761fb4sm154033qvs.73.2024.03.27.12.01.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 12:01:12 -0700 (PDT) Date: Wed, 27 Mar 2024 15:01:11 -0400 From: Johannes Weiner To: Vlastimil Babka Cc: Andrew Morton , Mel Gorman , Zi Yan , "Huang, Ying" , David Hildenbrand , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] mm: page_alloc: batch vmstat updates in expand() Message-ID: <20240327190111.GC7597@cmpxchg.org> References: <20240320180429.678181-1-hannes@cmpxchg.org> <20240320180429.678181-11-hannes@cmpxchg.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 2D2361C0022 X-Rspam-User: X-Stat-Signature: kc3jnip3w9ydcq37ip6pior7e5mhzaq9 X-Rspamd-Server: rspam03 X-HE-Tag: 1711566073-998249 X-HE-Meta: U2FsdGVkX188c44Ie0oj+A/jvcbjiy0GcoydD/dF2o9TCdYYAB8pWUcyrQImsgGULZErgZ1RYWl4JmmPwnBH+L91AONLosFo5NUPJOzbDJPhgmGYwwjbYiSAnL6J3h3rgXor/eOGVSSwQBjT3CdkvxrUvN4awzQHhyH+3HErmGvjeSjqVTRXoJq7/M6liVWtwX8epXn08QDIYeVkOlyG5c3e4EwhZAdu3+uzk8qfwnPm7suJ1JwNuZakW9RSbfc0j9l1lqbi6voS9vg4eYW8S6GJkS8SrDrdJy+RwxlPurdnnWjaXbRcXqI9IA9PusLFlQQ34LvJmIDCcWLcZUYiLl8gi6rRvMbCv5ODZjau+TrM9Y95KTW3md7AO08hVEBHf6uU/DvUXK/8ukwInGXbRHV9tuRU6TjHCIAFQ+pYa8DNNGV9EipB4M5mkt3dMhOqON9R3KXfVCfLlL/Z5zoqpNgve4N7fSVBlFKJ5Wq/QFgPs9wCm6/RhCNdi1oxLmGFvhzUQeVAHqr3/gZTtZ7oz3SdoutbM3a8lZ1VMEY3/ffHgIhE7Ik5acRJsW1Iob6vAQH77hbfDRRFluy5irBrTXLj6MGp5owTiGUhHD7ZIceTsbiyHrKFDjZYlX+ijWgQUTxw1WxEKlF0DGS7m4rzrSsVlgHfACclI3ka2NGuovRYta38lK+lVSZd/YHfxTw67Lb8DgAY2xTfuJ+Phw1iuWtOd5drNH4mS70d/XX4X/1l6WpHCJeV8D08BTUwJi9F3hsxZ4mteDT9nAe6g0jhmL/c+tm6ogEA6j79cYittRNrxfxOSEZkaffVjxn5remSw+AR+hb6lMqpAkaxDHXRElz3XULHbpcma4N81Zrf88HZVYlLjWUfB5dcs2MG5SQRr3xilMvcbf2S3Q2o9hdIyXNJnLc1PWIneMm3JnLU2NQdQmSWUyz3x+R/tx4o03FIn0/opOoPnjEkQcibEuI leJkzl4Z N5OcT8fE8YN8vJVGXlBDT+o07cNV/whgbqeGQBDuUy9KmP1FvBJYFzOwOYOtWSkY6/xBEZkn3VaezGvqk57n1GtBG+XOS2BaJnZmvEiLEfu8xaIeZ3cg+2mICkOvfhsGjQRMVmuqQVsxJSb4Bt/H/ORdsaXV4DXnX3vN75sHjBzxMZEHhyazvKdckUJijel9ySsgery/zc45rNbHKWld2liEwA1Ldx2Tjm5U44mUIh5qlkTTtV93BjYp0YtaMlgmrzlq5zhmn6LZ+zbGdmCvT3Y10q+SqbbZCJV7XQTSF/VPghSyW+txiDUoDUHf/y06tlQVg/3XV3lKXBoY8orGyuZVCtLHDo4tf3D9gMibHwzdjrSiTGPDi4WSeMvfBEwSO2ARRnqCW3Pd6q55OY/LLBipXkUQr0IpOGmK+IR8v8VDcnRQiIlmYv6AWBIwy95E8p1WJ2olIv1+OIRJkf5xG7Aab2/KeBYjvPPKca4Lmdycw0zjXvH7xbhHH5w== 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 Wed, Mar 27, 2024 at 09:54:01AM +0100, Vlastimil Babka wrote: > > @@ -1314,10 +1349,10 @@ static inline void expand(struct zone *zone, struct page *page, > > * Corresponding page table entries will not be touched, > > * pages will stay not present in virtual address space > > */ > > - if (set_page_guard(zone, &page[size], high, migratetype)) > > + if (set_page_guard(zone, &page[size], high)) > > continue; > > > > - add_to_free_list(&page[size], zone, high, migratetype); > > + add_to_free_list(&page[size], zone, high, migratetype, false); > > This is account_freepages() in the hot loop, what if we instead used > __add_to_free_list(), sum up nr_pages and called account_freepages() once > outside of the loop? How about this on top of the series? Could be folded into mm-page_alloc-consolidate-free-page-accounting, but for credit and bisectability (just in case) I think stand-alone makes sense. Reviewed-by: Vlastimil Babka --- From 361f5df28183d85c7718fe0b579438d3d58777be Mon Sep 17 00:00:00 2001 From: Johannes Weiner Date: Wed, 27 Mar 2024 12:29:25 -0400 Subject: [PATCH 3/3] mm: page_alloc: batch vmstat updates in expand() expand() currently updates vmstat for every subpage. This is unnecessary, since they're all of the same zone and migratetype. Count added pages locally, then do a single vmstat update. Suggested-by: Vlastimil Babka Signed-off-by: Johannes Weiner --- mm/page_alloc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 8987e8869f6d..13fe5c612fbe 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1341,6 +1341,7 @@ static inline void expand(struct zone *zone, struct page *page, int low, int high, int migratetype) { unsigned long size = 1 << high; + unsigned long nr_added = 0; while (high > low) { high--; @@ -1356,9 +1357,11 @@ static inline void expand(struct zone *zone, struct page *page, if (set_page_guard(zone, &page[size], high)) continue; - add_to_free_list(&page[size], zone, high, migratetype, false); + __add_to_free_list(&page[size], zone, high, migratetype, false); set_buddy_order(&page[size], high); + nr_added += size; } + account_freepages(zone, nr_added, migratetype); } static void check_new_page_bad(struct page *page)