From patchwork Sat Oct 22 07:51:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugh Dickins X-Patchwork-Id: 13015846 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 964AEC3A59D for ; Sat, 22 Oct 2022 07:51:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C89868E0002; Sat, 22 Oct 2022 03:51:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C39918E0001; Sat, 22 Oct 2022 03:51:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B27DF8E0002; Sat, 22 Oct 2022 03:51:18 -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 9ED538E0001 for ; Sat, 22 Oct 2022 03:51:18 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 707DDA0A2B for ; Sat, 22 Oct 2022 07:51:18 +0000 (UTC) X-FDA: 80047815036.26.953C715 Received: from mail-qv1-f42.google.com (mail-qv1-f42.google.com [209.85.219.42]) by imf15.hostedemail.com (Postfix) with ESMTP id 19368A0007 for ; Sat, 22 Oct 2022 07:51:17 +0000 (UTC) Received: by mail-qv1-f42.google.com with SMTP id h10so3341591qvq.7 for ; Sat, 22 Oct 2022 00:51:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to; bh=8fM6rYJPNHtl4EjJzSXNeXO5m5rruppxnLzFbil+25o=; b=m568v2h1e+k+xKMACAwemU+yZ9FKevprFt2xlnViXK6+xUsUAvsnkPuCPi1XQrZiE+ kwUs24/peh1N7SVlVAaJMh1TElGe8oZj6LdUVmGhoxnU42v2MAmkOV0T4JGfwd9hgMou IIOhlVUskbFnIde6S8sxXXuyiFckkVph6qfV2w0SGmwU+3BVDQrDELibPrlErnuKu054 dh5RUdRXBCU3rjzdyw52KKLhIY5pc8tebznqFMKUzmEGcG+mzYm9EMztYqI/Zd9Q0nW9 R0MVUeAJEA37qVBSzv5mqKgFyQc68OFZWYnGb4qSJ8PbRLGWpDcw8p0/z3NVD0z1i5sw sjDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=8fM6rYJPNHtl4EjJzSXNeXO5m5rruppxnLzFbil+25o=; b=YTuW9cBz+Y8t5HbT1Mxh7MItO/a08yXK/5ZKLTASm7Hg9Aitwc1i9/YKKPavtl/bSy ufYnJieG9hIt4BnPIPrF4GCCELXfvzD9k9ybdgeLCHkWdPlLFinhd8DFFRIE2R6tkPFo zlIZZStYnUrBmWwQoGnT94GbsCviBDt2Fx6lxFSp9vhrN9nq8wxKpzwKD/t7IuJboqFt RPjJXAeoOvCd0otBRUcqz1Gk9/tYgVPyoHqjmf49QHpHJP29ECQ9slXUSJyR3fYe+Oj6 M/uTb+VTQXH83l9PMhTcNDX9VPmKR0GPZPKkcpuM6yVo7cKS2oOkqpsLgf93T95xR9no fg1g== X-Gm-Message-State: ACrzQf0v3yf9Pxk3rP6A3Hwfox19XEuZyOg2ZUGlTM4xACus3wuOd7wE Tb9BfdJHkh9NX4zHUubbqCTGFg== X-Google-Smtp-Source: AMsMyM6wmhxMptBt3To5V35JYpDTyqYtGurH0UUxxG6yNTnj82CeT9yuzql9V3kkcvhrmrFhvX6crw== X-Received: by 2002:a0c:a79a:0:b0:4b1:ca99:177 with SMTP id v26-20020a0ca79a000000b004b1ca990177mr19460750qva.34.1666425077057; Sat, 22 Oct 2022 00:51:17 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id y21-20020a05620a44d500b006eed75805a2sm11420398qkp.126.2022.10.22.00.51.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Oct 2022 00:51:16 -0700 (PDT) Date: Sat, 22 Oct 2022 00:51:06 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Andrew Morton cc: Mel Gorman , Matthew Wilcox , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH] mm: prep_compound_tail() clear page->private Message-ID: <1c4233bb-4e4d-5969-fbd4-96604268a285@google.com> MIME-Version: 1.0 ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=m568v2h1; spf=pass (imf15.hostedemail.com: domain of hughd@google.com designates 209.85.219.42 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666425078; a=rsa-sha256; cv=none; b=QzjOD+5qgjDM8V7FDKAX2eZOU1z+LZMhq9xT2UfkP0fk0oHWZ8FmH0OwtUl6hDw/YEQLSw oaUXS9RBLZsQvwWVG3hkfEisCpX9afj7/eAqhrnjDnlDh0GNM0tC7tD0dtl+tdsHGNPDve +MchXT179PsRsZQMF6qpBqVa1/TAc3s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666425078; 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: references:dkim-signature; bh=8fM6rYJPNHtl4EjJzSXNeXO5m5rruppxnLzFbil+25o=; b=Wr0SNrcBEfMSbgd4294lKN5gQLfIo7MZqVQ7vTje70vb6d7/DjwO8KZw7AzP9Q1ScbJLcS AiIZlgAAsMwjnvY/NScXeQ+UDv/7RYsYZJGX5cxPmkKyMdHGm7s1V13MSW/V/botzL2YcK l8ZWkHye01bzeCyaEDWUUUD79kBIuT8= Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=m568v2h1; spf=pass (imf15.hostedemail.com: domain of hughd@google.com designates 209.85.219.42 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspam-User: X-Rspamd-Server: rspam10 X-Stat-Signature: gc1mpxynn66nk35frfq5hg37t8gk1ios X-Rspamd-Queue-Id: 19368A0007 X-HE-Tag: 1666425077-544034 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: Although page allocation always clears page->private in the first page or head page of an allocation, it has never made a point of clearing page->private in the tails (though 0 is often what is already there). But now commit 71e2d666ef85 ("mm/huge_memory: do not clobber swp_entry_t during THP split") issues a warning when page_tail->private is found to be non-0 (unless it's swapcache). Change that warning to dump page_tail (which also dumps head), instead of just the head: so far we have seen dead000000000122, dead000000000003, dead000000000001 or 0000000000000002 in the raw output for tail private. We could just delete the warning, but today's consensus appears to want page->private to be 0, unless there's a good reason for it to be set: so now clear it in prep_compound_tail() (more general than just for THP; but not for high order allocation, which makes no pass down the tails). Fixes: 71e2d666ef85 ("mm/huge_memory: do not clobber swp_entry_t during THP split") Signed-off-by: Hugh Dickins Cc: Mel Gorman Cc: Matthew Wilcox (Oracle) Cc: Acked-by: Mel Gorman --- mm/huge_memory.c | 2 +- mm/page_alloc.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 03fc7e5edf07..561a42567477 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2462,7 +2462,7 @@ static void __split_huge_page_tail(struct page *head, int tail, * Fix up and warn once if private is unexpectedly set. */ if (!folio_test_swapcache(page_folio(head))) { - VM_WARN_ON_ONCE_PAGE(page_tail->private != 0, head); + VM_WARN_ON_ONCE_PAGE(page_tail->private != 0, page_tail); page_tail->private = 0; } diff --git a/mm/page_alloc.c b/mm/page_alloc.c index b5a6c815ae28..218b28ee49ed 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -807,6 +807,7 @@ static void prep_compound_tail(struct page *head, int tail_idx) p->mapping = TAIL_MAPPING; set_compound_head(p, head); + set_page_private(p, 0); } void prep_compound_page(struct page *page, unsigned int order)