Message ID | 20240306041526.892167-6-hannes@cmpxchg.org (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 0A384C54E58 for <linux-mm@archiver.kernel.org>; Wed, 6 Mar 2024 04:16:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E88586B0088; Tue, 5 Mar 2024 23:16:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E27A26B008C; Tue, 5 Mar 2024 23:16:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C05E66B008A; Tue, 5 Mar 2024 23:16:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id AC9136B0088 for <linux-mm@kvack.org>; Tue, 5 Mar 2024 23:16:29 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 60E04160366 for <linux-mm@kvack.org>; Wed, 6 Mar 2024 04:16:29 +0000 (UTC) X-FDA: 81865302498.09.E240D68 Received: from mail-qv1-f45.google.com (mail-qv1-f45.google.com [209.85.219.45]) by imf22.hostedemail.com (Postfix) with ESMTP id B48E3C0016 for <linux-mm@kvack.org>; Wed, 6 Mar 2024 04:16:27 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=NfvqadLq; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf22.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.219.45 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=1709698587; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=PHzhRKVaAXnUD3rwBUEd7H3L3SS0VEeXzGBInhtmHvo=; b=114jRgNHK7OQD3YxhcmjQ55mV67FDj/DrW6i50HPoeuq+oWceGKHzqnvQ0CFwmJqkKI3A7 FXmCWx1u0WFlUFsaK0CyX1bPhiVA9hckxFGfznHGkZA10Q3DvsaziWjhWPw0YN5txg/s9j IKXQe6eioqUlp6Gi/bw+0GNDuIA98+Q= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=NfvqadLq; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf22.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.219.45 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709698587; a=rsa-sha256; cv=none; b=rHxf/eneuP2DvWh43id93ZRYWqcy66OZyFTyR+4+uy5B24SrXLO/af0r3m5m9JyVnffJMP XAwI8qStlE1KoCsz5Tt5npmVehSmD/B8/m4wHIOi1uUtq+K+Pb4dfkLAouAdgqwML00c6f AKI27rq8n55Qsf3wHG079zRiVEz13go= Received: by mail-qv1-f45.google.com with SMTP id 6a1803df08f44-69096fe743dso298496d6.3 for <linux-mm@kvack.org>; Tue, 05 Mar 2024 20:16:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1709698586; x=1710303386; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PHzhRKVaAXnUD3rwBUEd7H3L3SS0VEeXzGBInhtmHvo=; b=NfvqadLq/boO+sdZXcgiTiisrO3QjedtQrvC12WauA1Mk35Ep6jq89AaiPFUt4JG6z MMZcqyuAXGtVteyVRuszRzKjzv52Il6kzvKWUtBTSNYGxouE13A4ADUjh6Cup8hxXPXi CL18vNUaPz+D0U4fPbOZn13VtS1o5sZbPreIIod6XkQZchyTy9poX7vCnOALVUB+1/v3 MOxfbkUi0y9cWhs05COZE3PJl8aBZdiMMBHOT0w4jlLF9UdcAnww1dewbczGzV4UJ+S2 BaCc9wUU8nkyoIpUdToAmh0pe19RzjcxpiqyPCBpRxzRlhv6RselOKC33qKR52Sf5BR+ wIZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709698586; x=1710303386; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PHzhRKVaAXnUD3rwBUEd7H3L3SS0VEeXzGBInhtmHvo=; b=djkT5eV7sxTRaVXj/MNog6Nm50qVOgv8rC7SPoMUzrJ3HPya/qz62M/svGb/g+NQPu aO67WTK15yiRzkVQ8y6mkNQ/yrfBkei3YPHgNjGMfDYxlmSZb8ZOVpkHkwAvzy144nHx L3+hpNSx/pPwFdhlG9CFyFcPzod+e+RtZO0UqD6ZfB7Qro4L44hJ/vuVaC09I9nf7iPc OqfEJtmSitjsj3R33o7HPMRbqpCQ51/mttuDe3ENOvEJfIscYqgw4ztAlKAR7oEMTyHd ca+l3fFh4NaUddINis56HDUMXmDH4fw5+ySNAHhIpnARYw2FHVjzCXznx8X4ir7ppMl3 A/eg== X-Forwarded-Encrypted: i=1; AJvYcCXSxaa9hVFMVzQ14RDalkPGpn9GTbYtu0g8npEjXmv7P8h/lz8IRVLLkUGWaV4VIlITz1XxGQ6pbBUKrXplWHF1JHo= X-Gm-Message-State: AOJu0YzDsoqok9G/DN8a5gyX/QbQNTpVfk3CVoFQQqDmvL2lhFfbGIUP hoqSzeQqCa0iEYrdjNXn42fxvAWK6norJZsHQ2efC4T7olH0kGl68xxshts5uTc= X-Google-Smtp-Source: AGHT+IH8smcjvgVjtxikEQ23VUlaKW5EeZbBSaDCdCJJHUd5ddTW2ftWOlTEg3i010CDIhz/uidLPA== X-Received: by 2002:a0c:e9c4:0:b0:690:8aee:60ee with SMTP id q4-20020a0ce9c4000000b006908aee60eemr790372qvo.46.1709698586714; Tue, 05 Mar 2024 20:16:26 -0800 (PST) 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 ph7-20020a0562144a4700b0068f985ceb11sm6973369qvb.70.2024.03.05.20.16.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 20:16:26 -0800 (PST) From: Johannes Weiner <hannes@cmpxchg.org> To: Andrew Morton <akpm@linux-foundation.org> Cc: Vlastimil Babka <vbabka@suse.cz>, Mel Gorman <mgorman@techsingularity.net>, Zi Yan <ziy@nvidia.com>, Mike Kravetz <mike.kravetz@oracle.com>, "Huang, Ying" <ying.huang@intel.com>, David Hildenbrand <david@redhat.com>, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 05/10] mm: page_alloc: fix move_freepages_block() range error Date: Tue, 5 Mar 2024 23:08:36 -0500 Message-ID: <20240306041526.892167-6-hannes@cmpxchg.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240306041526.892167-1-hannes@cmpxchg.org> References: <20240306041526.892167-1-hannes@cmpxchg.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B48E3C0016 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 1f6wtnce95y3tgqxyekpmoorjn3i38ni X-HE-Tag: 1709698587-696884 X-HE-Meta: U2FsdGVkX18tOG01HQNP7rviJbdwgV/kPpbN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yW2mFrjSH1dW3aauE4qgW9gVp5QsLpoyeVq70xrW6I68CTS8o2CJByO8hqaoqdVyo8rF6focy/9mZoyjM2yLE3BnyfoSXMaUeyOw 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: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
[01/10] mm: page_alloc: remove pcppage migratetype caching
|
expand
|
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 0f385531e130..787ae3f0ac06 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1645,9 +1645,15 @@ int move_freepages_block(struct zone *zone, struct page *page, start_pfn = pageblock_start_pfn(pfn); end_pfn = pageblock_end_pfn(pfn) - 1; - /* Do not cross zone boundaries */ + /* + * The caller only has the lock for @zone, don't touch ranges + * that straddle into other zones. While we could move part of + * the range that's inside the zone, this call is usually + * accompanied by other operations such as migratetype updates + * which also should be locked. + */ if (!zone_spans_pfn(zone, start_pfn)) - start_pfn = pfn; + return 0; if (!zone_spans_pfn(zone, end_pfn)) return 0;
When a block is partially outside the zone of the cursor page, the function cuts the range to the pivot page instead of the zone start. This can leave large parts of the block behind, which encourages incompatible page mixing down the line (ask for one type, get another), and thus long-term fragmentation. This triggers reliably on the first block in the DMA zone, whose start_pfn is 1. The block is stolen, but everything before the pivot page (which was often hundreds of pages) is left on the old list. Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> --- mm/page_alloc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)