From patchwork Thu Apr 4 07:07:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 13617331 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 CA4BECD1292 for ; Thu, 4 Apr 2024 07:06:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E2A836B008A; Thu, 4 Apr 2024 03:05:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DDBDB6B008C; Thu, 4 Apr 2024 03:05:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C54686B0092; Thu, 4 Apr 2024 03:05:56 -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 A124F6B008A for ; Thu, 4 Apr 2024 03:05:56 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 68C96120F67 for ; Thu, 4 Apr 2024 07:05:56 +0000 (UTC) X-FDA: 81970964712.03.87F34B9 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by imf13.hostedemail.com (Postfix) with ESMTP id 5EF2220015 for ; Thu, 4 Apr 2024 07:05:54 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=DTeAE4Cs; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=HFc2R9tS; dmarc=pass (policy=none) header.from=suse.de; spf=pass (imf13.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.130 as permitted sender) smtp.mailfrom=osalvador@suse.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1712214354; 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=J4wwG5jpQSOVuMqfScgmDBg4jiw7p8cJsBUm20LXaGw=; b=Xnzx4XJ1qU5QH/sFVl2ySguzc2zjtr3N2WaJ+9P/k0QINlEJMFjIZlsPDTOQlnyDrk5RHw MgTD5ioJwGuLMX9Jq7s4h1s8m08h7WdUiEZ9MVigl2V7fTkISevbDkC0hBrKSe4uJO+Usn TILIo/jq9L3V5BT1ZzAszPAOlbWqLkw= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=DTeAE4Cs; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=HFc2R9tS; dmarc=pass (policy=none) header.from=suse.de; spf=pass (imf13.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.130 as permitted sender) smtp.mailfrom=osalvador@suse.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1712214354; a=rsa-sha256; cv=none; b=bRYGlm/rgzE9Cp//PR+gb8vmmxdVmDF3meXKxJk7+3bLS93eGDG3vwOH5EJOkeJWU4jIGh Xzk/VPFWsdv/j8BGVaGmlSZB9VPQHoiW/dyQ/N9B+FDzqj5O2jAq23g/J2d8hrsJG18fNr /hTi8FEDWi+Zxp7IFE+6hhM79UFWiE4= Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [10.150.64.98]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 19D81378EF; Thu, 4 Apr 2024 07:05:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1712214353; h=from:from:reply-to: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=J4wwG5jpQSOVuMqfScgmDBg4jiw7p8cJsBUm20LXaGw=; b=DTeAE4CsKqN3QlIzPAFEGEu264vov2pEAU74p3IMXEN0UUxbIwMY7WjLmpbOZI/Yo9i0f/ QtgaatcX3RYl4TDQSmZunCCmnz4X6M34Ce28kpEhZl16noUIxaotEvf4ooVyaBYguu7C4F +dGOXk6kbkbeJrXe/sfi0bzMWkxarAU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1712214353; h=from:from:reply-to: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=J4wwG5jpQSOVuMqfScgmDBg4jiw7p8cJsBUm20LXaGw=; b=HFc2R9tSN3nHIpQ56020vRM6DlTy536CD43M5GHP2BJMk5Y7fnoGEi7KWMz5cJE1VSC8tc AulWxQIGEB4CsAAQ== Received: from imap2.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id 838D0139E8; Thu, 4 Apr 2024 07:05:52 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap2.dmz-prg2.suse.org with ESMTPSA id kIhbHVBRDmY6cgAAn2gu4w (envelope-from ); Thu, 04 Apr 2024 07:05:52 +0000 From: Oscar Salvador To: Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Michal Hocko , Vlastimil Babka , Marco Elver , Andrey Konovalov , Alexander Potapenko , Alexandre Ghiti , Oscar Salvador Subject: [PATCH v4 4/4] mm,page_owner: Fix printing of stack records Date: Thu, 4 Apr 2024 09:07:02 +0200 Message-ID: <20240404070702.2744-5-osalvador@suse.de> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240404070702.2744-1-osalvador@suse.de> References: <20240404070702.2744-1-osalvador@suse.de> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 5EF2220015 X-Stat-Signature: x68opfbjkatxc97oejw1e9dn1e8drdzi X-Rspam-User: X-HE-Tag: 1712214354-235042 X-HE-Meta: U2FsdGVkX186evglK3qF7ff6h/RQGyZV0OWSE8RIni+NEE4izConwPFIwpEBwGAV8E6Dpos1c5MvvlgKaXC6n3ACBcFoCiRttl8uEOj1RMmOPuJx00gA1DoJfwAYFWwqRJlB4tuBguDaawNI7S8mmY4Y0i3CymkbvPijhxwZ4/AbapkhVTUGtZJLXrbXPNxc//1jzesYYFY8uMdIUWJ7zBgvNZR7IxEQNhGgxQpfcQ+iPYsSfsv5//6KZvFez1Ske57s1l/UNbSNawLoQ/qd8U6R801wFUea9K9hyRQc15JyTGJBE0k3pTAQhu2pB6uvSke94pLG95GtW6PVpX/yPMohoE6oIoZs1xRdy/1p95n7ZF/vbgFcDRCLQlUA38A4k0qKT5xJPaYDBwwEjYext7f9Jhy+8PnKfyVlCQdBYcCR2ytr+OcB85VTHK+pPRTqsEoNPRdW2E2IinhjqHok4rImvGSuXgRxY39BrsZI+h2sPiu3Atd88LrUFNqOhHJ0fMrrYQvsdhtkPthRmXzUPtQyppuJU6seHIaFZL58PuvN1DMnbNpejxb/aDW+6jUhW9UdDUOo8QOokOKtrdnAmcppwOJ16mEeXnEqoBqffce1QWxG7ZjoqZtMHbkuunsX2OHXNDTAiE3lQuqblEYuatURtX9QR2PVD5JUS2gtdvvHPYwYFvyDuH2QIkekPTcaSYVKTkOXxs/srRlvlSsYJ1Uxvli2oie6NAxBr8nbDObG2aU2LQzut3vPRF139RwP3ckKWa07tZFXKlIPObgeNpX6z0mJwIS7tZ2KAlrOREWLc3ptGqB0HMFFaor6/M7ztkV4r4brm8vDWi1Eu8ukH5dTGCQkaDLcz8URoBzn1QDwbKQU+FfM6p5mSfeVpnVX4kY7GheztV6tK0JArJW5w8AhjVP+IwkMtJIEvejAOJSAViB6GPRjYEZgsG7VTK7wfA4D9gkHHnfi5WntoTe U4x/ueQI F1VkGsxrHHwOSUKhd2g+QzT5ofZscA+TVCwMkSq3DW3PBmDquOxOxClgOts581Svg2BAOEM7qKsbdhWudbpgvQuIxABn0A3bVAZ/W+zAxVhVDKw5QUaNjlkoVUXwC3YKQ5Va5RdkI/B2qNat1/PFusFrV+vtZzfePSwqvI1IsTf/qiMduo5CpRF8nN8kxumM86W08UCQbARLjwXrO56W7WZjMB1Zdm1hZz4Z07PIII/vdg/sIDZld233ZHlRaGBGuk4Citoxfo+nOofRzR1vAmsaLSA== 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: When seq_* code sees that its buffer overflowed, it re-allocates a bigger onecand calls seq_operations->start() callback again. stack_start() naively though that if it got called again, it meant that the old record got already printed so it returned the next object, but that is not true. The consequence of that is that every time stack_stop() -> stack_start() get called because we needed a bigger buffer, stack_start() will skip entries, and those will not be printed. Fix it by not advancing to the next object in stack_start(). Fixes: 765973a09803 ("mm,page_owner: display all stacks and their count") Signed-off-by: Oscar Salvador Reviewed-by: Vlastimil Babka --- mm/page_owner.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mm/page_owner.c b/mm/page_owner.c index b4476f45b376..9bef0b442863 100644 --- a/mm/page_owner.c +++ b/mm/page_owner.c @@ -872,13 +872,11 @@ static void *stack_start(struct seq_file *m, loff_t *ppos) * value of stack_list. */ stack = smp_load_acquire(&stack_list); + m->private = stack; } else { stack = m->private; - stack = stack->next; } - m->private = stack; - return stack; }