Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp179576lqt; Mon, 18 Mar 2024 05:11:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWSZZmrgtvZ0c6rQZDqKDi/yPzJqo+fs7zafO18g8SdpyVY5U7dtG5EaSOoSquzPZT1D3eWMCrihsDb94j6rl+uLyVAjQ4GOqMs0Lo0pw== X-Google-Smtp-Source: AGHT+IGiQt67ECMPlQW3BIbetB1cnFBK+BBZ1wigZC2DejNAbiD3KB79IEr/eCODBgmNWsUv9Ghx X-Received: by 2002:a05:6402:913:b0:568:b95e:8012 with SMTP id g19-20020a056402091300b00568b95e8012mr5199342edz.14.1710763889530; Mon, 18 Mar 2024 05:11:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710763889; cv=pass; d=google.com; s=arc-20160816; b=WCICPaYFx8bkP09hdxO0uL6cztrMQmQOrH5g1KK3AMf41O4BPUuGr6QwCNbpbYa19Y Lo1SqaS0oyAFGN6N9W8S/6mwgMtU8HvqMKWOssPNaYmozD/3nUHAj9+HZ7xvIsTWCn9k kFxFMcskP+d/BsBUCwFD5BxU5MOKWEFlSUA0JtW5vuYDYRqTUwiCtpF9U4QX893es2CM CyBC4cmNICEMH5PUAPiqiPkNoS9eFd3urWCnS9xagQaEfX6BN2mfAjLfJIMIH71wP7Zw nGlUwb1I21DW8LCmnI0edJOOIaAeQ+bzxOjWSVsiD9jN9IHGyaf+eFfUIJ+kkU/Kd1WS f1pQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:to:from :dkim-signature; bh=VkBT1r5BPU5F/3B05HCHkD5OlONUkYMHyin3Hc3dSgw=; fh=toeKfgg+rihXGiDsFxlUaje1iqTqVCszR9NEe5/zt8w=; b=eb/WCEtjK5R+ugA0Fgkymv3CoBwffZ5uJJIFN/G3xmIb4FnPRHrFmiv3uSX/ikpDpK d3S8HoLSe/xz6WTV6hwHcFE3e88OoTV8bBJIx8JIZHj3+9vpSqdIu9DbT6RA9mdYLxRU R5eGotsNTya+OsXyv6DoNUD8vXt8le71Pt7p9WzlwmhE2iD4vGYBMO2hA0SsGszl3G6n D2lQwjIA9G5Y6wZBjDfudopO8asN/9kshHkggMJnQ9R3u5X8U40DtWmEQ2FyeXEhysg9 3fI9icn1F48HQtS/AbHmNSDJLVtoIFGBRGlmKr3QTTyfVZmiMDUM+EqkO5QrCi5juiDH 07DA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qhNCPdXY; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-106101-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106101-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id q5-20020a056402248500b00568c18ba317si2252141eda.610.2024.03.18.05.11.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 05:11:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-106101-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qhNCPdXY; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-106101-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106101-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 130ED1F238B6 for ; Mon, 18 Mar 2024 12:11:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 84404381B8; Mon, 18 Mar 2024 12:11:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qhNCPdXY" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B0424381A1 for ; Mon, 18 Mar 2024 12:11:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710763881; cv=none; b=mGw3VNU7GCAcx37z6xAYgRQF5hXNuTCSRj2ZwxwTbzDr2QXKn3L4oJQVfWJMi8tNe13hyXu/9OlrFH6k/dn2FR8MImuxA9B4QvXYrmFIwWUg2N5KQch9gktANW61wdx+jAJu+Cq6xXplDyTDg8sNES6se0FHWERS+vDqNDwfYAY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710763881; c=relaxed/simple; bh=JGYfbRVIlHuHoI0NmXjtxepKc6ayun3xXlgDn4j46pw=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=NKo3AZzvO7yhfo2sfRDADYYnAIENyIEorGGD2pnZSOUFaaI/g433KDP/r0ODHfaHBFStWlt/blHYWw0+KOZIKQR97nrkDLW5dDw87gSwtJ6thpzTNYDiM+9+jokTR/AKGodtRRev1khLdZ1XspHaM8xOxMyXy652bjwQB9HqZrA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qhNCPdXY; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A178C433F1; Mon, 18 Mar 2024 12:11:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710763881; bh=JGYfbRVIlHuHoI0NmXjtxepKc6ayun3xXlgDn4j46pw=; h=From:To:Subject:Date:From; b=qhNCPdXYMkprcVdjnMn62xTr1ev9QT80OeSwydB8rxi2JOdRpMbLfbVXABSBeqO/B QNn+lahk2HRco7Ry/mGwVwYXVhIJLQ2+vxjol3pMpexnomkDo1Az+EEj2IG3ZF4el1 sZqhtbj56qd+zBEiKBb6DkBfjX3ta6qqWlM7LLsTPx7SdIjd+BVi+MgVNksfGWnS1h SefuNpistEXlrQ3w9/+za8sLv4iS7nnwfoG6Fm89v+IoF1VemtGdNlml6j6rWgq2pY SmDsBHVyqF8tWaY6pj1lYDpJBHglTnCVyTnLA7bG2/QzrvSBqnzl4olfVuaIO022CA ZlvQG2kuW3KxA== From: alexs@kernel.org To: kasong@tencent.com, Andrew Morton , linux-mm@kvack.org (open list:MEMORY MANAGEMENT), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 01/12] mm/ksm: catch tail page abnormal in page_stable_node Date: Mon, 18 Mar 2024 20:14:30 +0800 Message-ID: <20240318121443.3991104-1-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Alex Shi commit 19138349ed59 ("mm/migrate: Add folio_migrate_flags()") change the meaning of func page_stable_node() to check the compound head for tail 'page' instead of tail page self. But seems both semantics are same at results, the func always return NULL for tail page. So adding a bug monitor here in case of abnormal. Signed-off-by: Alex Shi Cc: Izik Eidus Cc: Matthew Wilcox Cc: Andrea Arcangeli Cc: Hugh Dickins Cc: Chris Wright To: linux-kernel@vger.kernel.org To: linux-mm@kvack.org To: Andrew Morton --- mm/ksm.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mm/ksm.c b/mm/ksm.c index 8c001819cf10..3ff469961927 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -1091,7 +1091,12 @@ static inline struct ksm_stable_node *folio_stable_node(struct folio *folio) static inline struct ksm_stable_node *page_stable_node(struct page *page) { - return folio_stable_node(page_folio(page)); + struct ksm_stable_node *node; + + node = folio_stable_node(page_folio(page)); + VM_BUG_ON_PAGE(PageTail(page) && node, page); + + return node; } static inline void set_page_stable_node(struct page *page, -- 2.43.0