From patchwork Fri Mar 21 05:31:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gavin Shan X-Patchwork-Id: 14024873 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 8C37EC35FFF for ; Fri, 21 Mar 2025 05:32:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 92E35280004; Fri, 21 Mar 2025 01:32:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8DE61280001; Fri, 21 Mar 2025 01:32:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 78268280004; Fri, 21 Mar 2025 01:32:28 -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 57A41280001 for ; Fri, 21 Mar 2025 01:32:28 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id A78D3160B70 for ; Fri, 21 Mar 2025 05:32:29 +0000 (UTC) X-FDA: 83244438018.06.C03E72E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf28.hostedemail.com (Postfix) with ESMTP id DFD87C0004 for ; Fri, 21 Mar 2025 05:32:27 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="V5DX+/m3"; spf=pass (imf28.hostedemail.com: domain of gshan@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=gshan@redhat.com; dmarc=pass (policy=quarantine) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1742535147; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=/lpSCB8BhAtQd/roFhxiAeh+Ow96uVGCOGIfu1pyhrw=; b=s0F8QiXzk1nLy78AXcvE2DB7t6mWK6PLPYPv39BjCcRgJUbQiqMtMoIU3S8L4B1ZbQJPnC Q//zHMrm2dbyr6Papy+4NNggrwX1OPb/x2f9vRBeZ13VJjP5Q5jmTuQGwGl/Gh2zEhYBNa tuMpJO7GLLpHaBY3Tvsqp5AqovqoEGU= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="V5DX+/m3"; spf=pass (imf28.hostedemail.com: domain of gshan@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=gshan@redhat.com; dmarc=pass (policy=quarantine) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1742535147; a=rsa-sha256; cv=none; b=z5hM3QasgOOYfOyChYcyKh75IVo8MXsn0DlupQwO/VxU5RPYvx+UzZoRPJG58omoubE7Bx DWF2Fkht8vT8TJyQzRn57ZesjZr9B6isNjSd/IOOWbl0cTiIiGcEuCwN+rGymg0hNS/oWM lgtLAffJXueP3Iq6zrPrbN1ZPg20vdY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1742535147; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/lpSCB8BhAtQd/roFhxiAeh+Ow96uVGCOGIfu1pyhrw=; b=V5DX+/m3XLzUJ9pdXO6C0kVZuDXCWOprtuPO1kZ9BcEk8GMWmvjy2Zr9ox+CFejXVyGH81 d/M3IlKAskss/e1k0+AxnF6cfx85u6bZWquGqUjN6X0ptZrEkD1AMYgR0U4y0rEYVG/dBc gEx2k3ZzPzsoltZawdf+/pXV3uGqVTM= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-212-9WcBLVVEM6WOIlvEUBSJJA-1; Fri, 21 Mar 2025 01:32:21 -0400 X-MC-Unique: 9WcBLVVEM6WOIlvEUBSJJA-1 X-Mimecast-MFC-AGG-ID: 9WcBLVVEM6WOIlvEUBSJJA_1742535140 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D84821800257; Fri, 21 Mar 2025 05:32:19 +0000 (UTC) Received: from gshan-thinkpadx1nanogen2.remote.csb (unknown [10.64.136.79]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C4CF5192ED65; Fri, 21 Mar 2025 05:32:13 +0000 (UTC) From: Gavin Shan To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org, willy@infradead.org, david@redhat.com, vbabka@suse.cz, osalvador@suse.de, gehao@kylinos.cn, shan.gavin@gmail.com Subject: [PATCH 2/2] mm/debug: Fix parameter passed to page_mapcount_is_type() Date: Fri, 21 Mar 2025 15:31:48 +1000 Message-ID: <20250321053148.1434076-3-gshan@redhat.com> In-Reply-To: <20250321053148.1434076-1-gshan@redhat.com> References: <20250321053148.1434076-1-gshan@redhat.com> MIME-Version: 1.0 X-Scanned-By: M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7+baFM5lY6C+Lr8+H3B304SNiFKz2cDTVQTctC4Fro vXbmrP6b 7O9dSbAa8ybSb1BshEK7uKZA89fy0u0OvL6c+Bg73rvGX0yXOGO5/OL+3T1csmyntJJs8/TmXA9kQfu3aZGd8VoRzGRekMJAH+jZtg5xi9GRh/h7h40XOy21gs5S71l83q8MT2NBaKMGUaGlkhKqivb0KPQJ1L3VN1MbmdNDcraviusFIDbRe8b9l28tPQCJm9DzkZFMMvynPW088c4Etf+B0NSYGc+w/uOANC7sXcZPqt0qOxssKTB9ez5v/YO5+M2DS4tkZ5xP9Tz/q9rOtGfgd/QS6QUBci+tlpabCtsmVwrdiZ0tRX5qgKYC2nJd14O1i4A06jDn9YAywimEIDoFwYWye6jESFAoAm8Di80km88TYznmbTS4/hmZQAUwtrcg5h39MFyNPxZpjnPes2E2y+GnTW3DkOstL9k+Mt/keLbFQDoiSYSxxezv+DUNs4VlyaeY8q75r03wO3bzOZ/abPgUTNW1Zvcr/ 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: As the comments of page_mapcount_is_type() indicate, the parameter passed to the function should be one more than page->__mapcount. However, page->__mapcount is passed to the function by commit 4ffca5a96678 ("mm: support only one page_type per page") where page_type_has_type() is replaced by page_mapcount_is_type(), but the parameter isn't adjusted. Fix the parameter passed to page_mapcount_is_type() to be (page->__mapcount + 1). Fixes: 4ffca5a96678 ("mm: support only one page_type per page") Cc: stable@vger.kernel.org # v6.12+ Signed-off-by: Gavin Shan Acked-by: David Hildenbrand --- mm/debug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/debug.c b/mm/debug.c index 8d2acf432385..b6bd9555ec7b 100644 --- a/mm/debug.c +++ b/mm/debug.c @@ -71,10 +71,10 @@ static void __dump_folio(struct folio *folio, struct page *page, unsigned long pfn, unsigned long idx) { struct address_space *mapping = folio_mapping(folio); - int mapcount = atomic_read(&page->_mapcount); + int mapcount = atomic_read(&page->_mapcount) + 1; char *type = ""; - mapcount = page_mapcount_is_type(mapcount) ? 0 : mapcount + 1; + mapcount = page_mapcount_is_type(mapcount) ? 0 : mapcount; pr_warn("page: refcount:%d mapcount:%d mapping:%p index:%#lx pfn:%#lx\n", folio_ref_count(folio), mapcount, mapping, folio->index + idx, pfn);