Received: by 2002:a05:7208:31d3:b0:81:e143:7c29 with SMTP id v19csp2635392rbd; Tue, 9 Apr 2024 12:30:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVn5740u4eicrokVw1rv/rnlcKrq65DtFPAjyfnxOkHzlqfDsK1cBkhnwmj34pruXWpgyS843ittZn5J+wbO/iogIZ9MQ8YGpPw6XkY3A== X-Google-Smtp-Source: AGHT+IHum5Yfajx7YxFMgCHofRMaZLVYURGPFgO/6LqEdyuv422j5lZ6NOw9pK6aiOPTThEGOSdf X-Received: by 2002:ac2:4d03:0:b0:516:d280:f588 with SMTP id r3-20020ac24d03000000b00516d280f588mr261512lfi.42.1712691018777; Tue, 09 Apr 2024 12:30:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712691018; cv=pass; d=google.com; s=arc-20160816; b=iCgoGNISf2LbaNGuFC1YsLa0rgrSmSyajL/0d4YdXBWnVoEVwEDsY8ETC4r0Yhfkyk yPtWliERwyTDnV2vRbnYoEzMvkyl6qDZqZjY/63zl/fXcUXIZ0gj1Kd+0Pm/ULT+UTh4 qrvEXb4uJhU2W5xtPqirJTmtgq/0k5/Bkdw0WCBhI+NW+pVVIbt2MNvXNl2LTzQj5avC jMD9ynqiJsJGAnYS9vn+yU5xYz7OFAe5sA9nPJdBPtLgIqb/jYvBcT5OYvC5RwVSnd+J mxw9Y/4BHSmhvPRUWvzcGykFrCKEw87h+I+tZGk9utp4M0eGS9n+uUEqk8FIcutj3tRs XUMA== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=9BvBZKQ0eVCGMopeE4n6MDTyBxCnbPUcn/eYDU7e+Xc=; fh=6UXOkRl8PLWnLRlJFkZ1FKxRpZrfO06mwvecZ/lFyqY=; b=QF+kphGcm8RKmpltN+yzpPP8U98hfidHqHTu0Gc275hYQPEvOqQNdM0JWHlz/ZME0S xhVTjJyI95UPab3puP/b+Tu9+dSBO555e3oz+mTBKI7VrcVV/IpFsVEPX8dNLzDbCwhf eFrS/x5cK/lUh1XgGRxrGUO1ba96bdOaHtx/WZO3IGkV1YdiLExIt194aj765zaSQJBi QMt+NNwRRXMMD+DxOM2zQuBdpHpaCD1wbZwT1LnwVg/sDTSrnqzelFqPjKjxL73ihDj5 WXFeAyImuCQ0cHX9FF156XWIgRAeRRqirIh8SH89g+q/ZAWlkQkKvIhld3fCtlPli3jw nCHw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XbSiT6EQ; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-137536-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137536-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id i21-20020a170906a29500b00a44444998ebsi5139818ejz.215.2024.04.09.12.30.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 12:30:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-137536-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=@redhat.com header.s=mimecast20190719 header.b=XbSiT6EQ; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-137536-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137536-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 84B841F21979 for ; Tue, 9 Apr 2024 19:30:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4B1D41586F8; Tue, 9 Apr 2024 19:27:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="XbSiT6EQ" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 1BB6B156F5D for ; Tue, 9 Apr 2024 19:27:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712690823; cv=none; b=fxCsQ90ttjyRDE0gfSKG1y01iRUWJUxgeR8p9ggB4Mqt8rdn50ji1VZdfFKtbU9T9cOJcg+WN60N4dM7q6zwUtga1rkXFkADNILkd7GkYkIPoqqE2vBmZVRnE6EzvuX97se3vQjJDUFOE6YUQ+TlUvG8U7HZ1l4jov51UKtYujE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712690823; c=relaxed/simple; bh=sYeMlPL5beHAUJA6nbySpZ8t2Qp6YBalKzijeijJLW4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UMPqXHtXIU+8wyFOUNGSJIdXjgcPbKlDPeblnr9uV/Etchd/k4sauVpk/4iIMZC2w3L/5QGpNY82gPEm1EaT4ddcb+xMhV1IUnWtsgRNzauDqornRmwaiFKNAmi06XuWDYSqwG7bxfrUbgsamnMqZdde+vnCW5jTnr2DquLPIH8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=XbSiT6EQ; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712690821; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9BvBZKQ0eVCGMopeE4n6MDTyBxCnbPUcn/eYDU7e+Xc=; b=XbSiT6EQc2SKt5acZzX/h1wmR0FghBD59QlBsE6clzZHBdpc9jwKYihJoLDm1bzenmHxqh nVXJdvNb5A94L826Nti37gn0FT9nmuAmW9Amd2oE5j3fHYDubfrLeVtvgUHVzgbCLmjCOY B96WDJbGmy5Uyrf1HvgECrdlaIojtI0= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-183-3faOSIxmOvCIGn74HLebCA-1; Tue, 09 Apr 2024 15:26:53 -0400 X-MC-Unique: 3faOSIxmOvCIGn74HLebCA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 76CA5188ACAA; Tue, 9 Apr 2024 19:26:52 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.39.192.106]) by smtp.corp.redhat.com (Postfix) with ESMTP id C430140B497A; Tue, 9 Apr 2024 19:26:40 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-doc@vger.kernel.org, cgroups@vger.kernel.org, linux-sh@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, David Hildenbrand , Andrew Morton , "Matthew Wilcox (Oracle)" , Peter Xu , Ryan Roberts , Yin Fengwei , Yang Shi , Zi Yan , Jonathan Corbet , Hugh Dickins , Yoshinori Sato , Rich Felker , John Paul Adrian Glaubitz , Chris Zankel , Max Filippov , Muchun Song , Miaohe Lin , Naoya Horiguchi , Richard Chang Subject: [PATCH v1 17/18] mm/debug: print only page mapcount (excluding folio entire mapcount) in __dump_folio() Date: Tue, 9 Apr 2024 21:23:00 +0200 Message-ID: <20240409192301.907377-18-david@redhat.com> In-Reply-To: <20240409192301.907377-1-david@redhat.com> References: <20240409192301.907377-1-david@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 Let's simplify and only print the page mapcount: we already print the large folio mapcount and the entire folio mapcount for large folios separately; that should be sufficient to figure out what's happening. While at it, print the page mapcount also if it had an underflow, filtering out only typed pages. Signed-off-by: David Hildenbrand --- mm/debug.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/mm/debug.c b/mm/debug.c index d064db42af54..69e524c3e601 100644 --- a/mm/debug.c +++ b/mm/debug.c @@ -55,15 +55,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) + 1; + int mapcount = atomic_read(&page->_mapcount); char *type = ""; - /* Open-code page_mapcount() to avoid looking up a stale folio */ - if (mapcount < 0) - mapcount = 0; - if (folio_test_large(folio)) - mapcount += folio_entire_mapcount(folio); - + mapcount = page_type_has_type(mapcount) ? 0 : mapcount + 1; pr_warn("page: refcount:%d mapcount:%d mapping:%p index:%#lx pfn:%#lx\n", folio_ref_count(folio), mapcount, mapping, folio->index + idx, pfn); -- 2.44.0