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 8C364EE645D for ; Fri, 15 Sep 2023 14:16:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E81D46B0373; Fri, 15 Sep 2023 10:16:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E31506B0374; Fri, 15 Sep 2023 10:16:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CF97F6B0375; Fri, 15 Sep 2023 10:16:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id C00886B0373 for ; Fri, 15 Sep 2023 10:16:15 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 901F540C0C for ; Fri, 15 Sep 2023 14:16:15 +0000 (UTC) X-FDA: 81239031510.19.A60AA06 Received: from mail-qv1-f52.google.com (mail-qv1-f52.google.com [209.85.219.52]) by imf24.hostedemail.com (Postfix) with ESMTP id 9CE9718000A for ; Fri, 15 Sep 2023 14:16:12 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=a2O4X80E; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf24.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.219.52 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=1694787372; 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=G2Uip1Uwb6xT/nQq1q2KQArOgZwENC9dRHuAMMnQr3I=; b=LzyuplSqltyKGuJl1Y6vfJr9WvrZ1yDqJxfZtMFkj7dhBt/3e/8mJPlxImsSd9fhkHzPor /8h/vHAI1QuvCOMkQ3mLe7NMdvXd1Q4WLU+/4I5Ce/52Id2gqdtIYvjXSYeT0sBGxtbwhm udFyJlblyrP1OiD9J+cM9pnoIr3hgKA= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=a2O4X80E; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf24.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.219.52 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694787372; a=rsa-sha256; cv=none; b=MXDvozLMV6NL8yLoN/6k4cV2a+7wgmMQ/ciVsZ4uJJQENBn4sFOU9khFeCog5Svb56IokS K9OlL5I7/vFZW7hnZLKz5TEubevsnUPCXNhcUoA5oOw9kai1lCakRgmM1Mhi3V4oHoJr2x kWE1okximx16N7pzTvCjEoZFW5NGr98= Received: by mail-qv1-f52.google.com with SMTP id 6a1803df08f44-656262cd5aeso9140996d6.3 for ; Fri, 15 Sep 2023 07:16:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1694787371; x=1695392171; 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=G2Uip1Uwb6xT/nQq1q2KQArOgZwENC9dRHuAMMnQr3I=; b=a2O4X80EQLEPJOOa3U1n+g7A5SBYBZVp+OBuIz1dmf6uY5WcbRjYlH8crBnukm7DG2 AF1N7Y1zTgZI9lnXAXD0i2MVjef4isr6iGozcfP1kI7JunhQy+SLnVwdXJLzf8UbvURj s9j3JI8e+eiXRRyjRBXhIQD4ILPIlS6lJS40RVsy3M7g5fAN5ZDNnCPFnmNohduxWkkS K5oeNX9FoRWOsBb6pbgZFOMmJKQV2odznT4IyrmA+X23HGEqbY+JJ881eMJ96/Ocv5eP bmiJmMs4Z04K3XQSSYraUo0Z+vub/fqvhJyHG4Y0zij3GVE82mFGCR3KkHfi9cIRvzAA Tb0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694787371; x=1695392171; 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=G2Uip1Uwb6xT/nQq1q2KQArOgZwENC9dRHuAMMnQr3I=; b=OxbbBw+d/FqHIvcx/nH9ek2P+89m1/D20dDheL9t6V1ylPnEm0eTDSXKf9cyQaUBTH P6raP7LWPjoFPrmIpL2mHFkvBaN0ubntT1pPJMd6yFN69EymZL4X6FoE6NfrO5nNNdUV N+crgFDSeV3+p/UXo+EMBsqTp7l3HoftcjWCll3JA1XCeGLC+1KxhnhALWqN2nwM4rex l/puXYUBsV/2UQ9YEMeKOK9nr8IaYSb33TWwZNzWF7K/Edr/rSLX5iAcCycUUFpWzX+p yOD9W7QctersS/ESQN81fhJqNoAYpwCnOFVpAmMYQXIaXl1UN5N2DgPrZ9aVcv+QYaql D+Yw== X-Gm-Message-State: AOJu0YyuTydU+L+lKx7Ta9bcBZo3y0VhjMllIotcawi6chwRw0zZQsHz 9cYHUNXY0maCY20uVGAF7ixORA== X-Google-Smtp-Source: AGHT+IEbdBO57oa5jdADk6A7X6ER8G0uRza8ttdV8YUgsuA0bMwCeymVC7cGI7d5I5fqSa/F1F3j5Q== X-Received: by 2002:a0c:f3cc:0:b0:655:e577:88e4 with SMTP id f12-20020a0cf3cc000000b00655e57788e4mr1996136qvm.32.1694787371633; Fri, 15 Sep 2023 07:16:11 -0700 (PDT) Received: from localhost ([2620:10d:c091:400::5:35bb]) by smtp.gmail.com with ESMTPSA id h3-20020a0cf443000000b0064f66ae4be3sm1300287qvm.88.2023.09.15.07.16.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 07:16:11 -0700 (PDT) Date: Fri, 15 Sep 2023 10:16:10 -0400 From: Johannes Weiner To: Mike Kravetz Cc: Andrew Morton , Vlastimil Babka , Mel Gorman , Miaohe Lin , Kefeng Wang , Zi Yan , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V2 0/6] mm: page_alloc: freelist migratetype hygiene Message-ID: <20230915141610.GA104956@cmpxchg.org> References: <20230911195023.247694-1-hannes@cmpxchg.org> <20230914235238.GB129171@monkey> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230914235238.GB129171@monkey> X-Rspamd-Queue-Id: 9CE9718000A X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: pxi5uiqeega7u97ws3bk1c3uucursici X-HE-Tag: 1694787372-630676 X-HE-Meta: U2FsdGVkX18+tEi55oL2+XMg+kZWDJWkFqTYe75eX6wJnQ4nOvZJqGbeEuCIDZ71210ZJxUpVi87wSW1Jnq7GETa8Pq9KT14PeRF7pUJUe86OXXdpLXkrG7xx9oMQ9ZvDNrJ7tLTKQyXew3zH5wHzRgXd5b9jIs52V5YYqtzg71vegwyTvp7e7So6HFBvePRqLug/HT2rkb2be96fOqqrUVHTerKVIMrPjhohJ0p5khc2hQYDsMj1hYTBfvsdkRVVTgRIhEPJbD8YCx9buX5YFgbqvYyTCJaUH1Guvqj12HN0LW/zzOfzzA4y2na2fFrnKUDhYz2YoxBeMIc8m48JMrJSPlRGk+fGFGDACkV03zJgAEPrte0DT+vh3S1lVppsC8XX1HS4H6yVWMF3jxvEYBh/NdldftzKKKMRJUVnPZ3POzbulpuh5cRFXfjK7mkPJpj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rZ4DDM= 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 Thu, Sep 14, 2023 at 04:52:38PM -0700, Mike Kravetz wrote: > In next-20230913, I started hitting the following BUG. Seems related > to this series. And, if series is reverted I do not see the BUG. > > I can easily reproduce on a small 16G VM. kernel command line contains > "hugetlb_free_vmemmap=on hugetlb_cma=4G". Then run the script, > while true; do > echo 4 > /sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages > echo 4 > /sys/kernel/mm/hugepages/hugepages-1048576kB/demote > echo 0 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages > done > > For the BUG below I believe it was the first (or second) 1G page creation from > CMA that triggered: cma_alloc of 1G. > > Sorry, have not looked deeper into the issue. Thanks for the report, and sorry about the breakage! I was scratching my head at this: /* MIGRATE_ISOLATE page should not go to pcplists */ VM_BUG_ON_PAGE(is_migrate_isolate(mt), page); because there is nothing in page isolation that prevents setting MIGRATE_ISOLATE on something that's on the pcplist already. So why didn't this trigger before already? Then it clicked: it used to only check the *pcpmigratetype* determined by free_unref_page(), which of course mustn't be MIGRATE_ISOLATE. Pages that get isolated while *already* on the pcplist are fine, and are handled properly: mt = get_pcppage_migratetype(page); /* MIGRATE_ISOLATE page should not go to pcplists */ VM_BUG_ON_PAGE(is_migrate_isolate(mt), page); /* Pageblock could have been isolated meanwhile */ if (unlikely(isolated_pageblocks)) mt = get_pageblock_migratetype(page); So this was purely a sanity check against the pcpmigratetype cache operations. With that gone, we can remove it. --- >From b0cb92ed10b40fab0921002effa8b726df245790 Mon Sep 17 00:00:00 2001 From: Johannes Weiner Date: Fri, 15 Sep 2023 09:59:52 -0400 Subject: [PATCH] mm: page_alloc: remove pcppage migratetype caching fix Mike reports the following crash in -next: [ 28.643019] page:ffffea0004fb4280 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x13ed0a [ 28.645455] flags: 0x200000000000000(node=0|zone=2) [ 28.646835] page_type: 0xffffffff() [ 28.647886] raw: 0200000000000000 dead000000000100 dead000000000122 0000000000000000 [ 28.651170] raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000 [ 28.653124] page dumped because: VM_BUG_ON_PAGE(is_migrate_isolate(mt)) [ 28.654769] ------------[ cut here ]------------ [ 28.655972] kernel BUG at mm/page_alloc.c:1231! This VM_BUG_ON() used to check that the cached pcppage_migratetype set by free_unref_page() wasn't MIGRATE_ISOLATE. When I removed the caching, I erroneously changed the assert to check that no isolated pages are on the pcplist. This is quite different, because pages can be isolated *after* they had been put on the freelist already (which is handled just fine). IOW, this was purely a sanity check on the migratetype caching. With that gone, the check should have been removed as well. Do that now. Reported-by: Mike Kravetz Signed-off-by: Johannes Weiner --- mm/page_alloc.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index e3f1c777feed..9469e4660b53 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1207,9 +1207,6 @@ static void free_pcppages_bulk(struct zone *zone, int count, count -= nr_pages; pcp->count -= nr_pages; - /* MIGRATE_ISOLATE page should not go to pcplists */ - VM_BUG_ON_PAGE(is_migrate_isolate(mt), page); - __free_one_page(page, pfn, zone, order, mt, FPI_NONE); trace_mm_page_pcpu_drain(page, order, mt); } while (count > 0 && !list_empty(list)); -- 2.42.0