Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4919375ybv; Tue, 11 Feb 2020 05:56:38 -0800 (PST) X-Google-Smtp-Source: APXvYqw6GHVFNj7AD9pS6KinKRGjjBKpyik5azRG6b1rihKOGovl6wwyWleWgeWIw8sycCWG2aj7 X-Received: by 2002:aca:f10:: with SMTP id 16mr2807786oip.117.1581429398816; Tue, 11 Feb 2020 05:56:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581429398; cv=none; d=google.com; s=arc-20160816; b=KvlcTGTevx/IFuzn0stG+OKXFX9KqkF7XauJFAKYRAaVV7tk5c9/TlK3+FUNw9OGaR ktF/abzU0Ehu8YmiExprDddIfY6PJqK/x3PzKmwxTnM33jtGPPJVp7t7vNdoIhr23xB9 sg2NHeCaiuwaYaMO3h8NSUvXh21yXsm96zx8lJnczMUtyY1n6olwczRn05S0+blEq2i7 mqTOiya+m6Ak75lDLavbPUlJUfJhbvvBbD9rGPeqqGrPB8E7xvxBaIBTPIEgvLUAIATn PkpnmABS6tHMoJAjnjht7+VVVl2/qvt6Qo3Q3l4kosJ5VeOXHn2sKu5ySubLRDCbvufG 8KVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Hr4RM1uoMUp4PqitGEd8DPH0BhvKXrOmDlEYhlDDK/I=; b=INEaJlxoBr+ew7MbicbUWZsImReasRjmNTernCTfHvUXB3IdCIWustExiCEudjN9/z Lqn3e4mrBttf/Im1aQXash44TXS1aSvnDoDB5ax1Bfwi7s0A7TPpoSLm7PosZYFsFYDd G/LpFq5FsPr9a4BkeeCTUmyQC6wbfL9YjFJV4nSedM+TxMyc6RTanTKGgnhy9B6Rq3BX pG7fQrkKUa6/59E0tEO00GcdA68dquk26EKjIvOgDNw/OrbjG7mUP0+rfSE8oX5Bm4fr Roe+jLdhiUJ1PPH1kI6a4fkM2WCkEKFY6s9v7g+RONFHyK9kiucdXj2t/DO3wcIPZhk0 /Qpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=bFc+jsaX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v6si1837207ota.19.2020.02.11.05.56.27; Tue, 11 Feb 2020 05:56:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=bFc+jsaX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729045AbgBKNVo (ORCPT + 99 others); Tue, 11 Feb 2020 08:21:44 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:33080 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728573AbgBKNVo (ORCPT ); Tue, 11 Feb 2020 08:21:44 -0500 Received: by mail-lf1-f65.google.com with SMTP id n25so7004923lfl.0 for ; Tue, 11 Feb 2020 05:21:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Hr4RM1uoMUp4PqitGEd8DPH0BhvKXrOmDlEYhlDDK/I=; b=bFc+jsaX1bV6Bl3CuP+Cavm+epSok3Y8YuARU6618UpGWA+riHbOEsKSpMLVF0ZXnU bY7fqdQ0bEnWWZfLd6Oqd9qX1D757FrAYb+O8BaQ+LQhdXMTPs51Hy2WUXzJ4Ad24uj4 cvUYk6SVn5+//nUOhXYL42dvCGwEwZFRn+X4g8zbG1FE0jal/OsaVU08xzOzzjWLIm0D 8MwIcgxr3JmYIH/VoOmj8XDIQ6QhVzIhQMilukMtaXwupCH3WebHq6ULuGRH9rDVgw9o yY56NRlMCQ15lfK+PifbXajl/TM4KUteetaHmFwDIJm5VG8+ct0cSww9niJRGFLxEBTQ oHNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Hr4RM1uoMUp4PqitGEd8DPH0BhvKXrOmDlEYhlDDK/I=; b=bWd9WFOJmHncZx6FR5ll8SsFpdq/PP96Vi2R0UJcfewiaCPk2jjSn97u3sSaJ31pLf ONzEWaI4PGZdsZ+TnmoN9jOprzRi/oRuNlTDdIAwkQBpqYSC7hjSzIvlR0BnkJTWk5nO XTsejInA3niW/gq5DjZ1yl58/dLxnKgtQSUhB/8a88orKu3F5CARyG+Zx2/32vPevNVM UawETk8USxml0b/hYIEtLWP+Q389RgzCwcLEJdVWtVaS7P36o/ZsA5gJFUvCpWbDlDul 8+kt06JXQVYuiNPa1Yj/Sl4/IJgB09seC4dkq9703cOfYRbr97/BcLWLvOUyrqYlM9zM 4FWg== X-Gm-Message-State: APjAAAVmHx2CPVsqP8+QKJsRF5ES+IzD/7GQrH56gag3si2C+sL4it1+ o7lDXt+TPDXgbj5U1IBCUH/Waw== X-Received: by 2002:a19:8c4d:: with SMTP id i13mr3655524lfj.42.1581427301828; Tue, 11 Feb 2020 05:21:41 -0800 (PST) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id a8sm2166091ljn.74.2020.02.11.05.21.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Feb 2020 05:21:41 -0800 (PST) Received: by box.localdomain (Postfix, from userid 1000) id D76B5100AFB; Tue, 11 Feb 2020 16:21:59 +0300 (+03) Date: Tue, 11 Feb 2020 16:21:59 +0300 From: "Kirill A. Shutemov" To: John Hubbard Cc: Andrew Morton , Al Viro , Christoph Hellwig , Dan Williams , Dave Chinner , Ira Weiny , Jan Kara , Jason Gunthorpe , Jonathan Corbet , =?utf-8?B?SsOpcsO0bWU=?= Glisse , Michal Hocko , Mike Kravetz , Shuah Khan , Vlastimil Babka , Matthew Wilcox , linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-rdma@vger.kernel.org, linux-mm@kvack.org, LKML , "Kirill A . Shutemov" Subject: Re: [PATCH v6 12/12] mm: dump_page(): additional diagnostics for huge pinned pages Message-ID: <20200211132159.pii2x5pssifemgaz@box> References: <20200211001536.1027652-1-jhubbard@nvidia.com> <20200211001536.1027652-13-jhubbard@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200211001536.1027652-13-jhubbard@nvidia.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 10, 2020 at 04:15:36PM -0800, John Hubbard wrote: > As part of pin_user_pages() and related API calls, pages are > "dma-pinned". For the case of compound pages of order > 1, the per-page > accounting of dma pins is accomplished via the 3rd struct page in the > compound page. In order to support debugging of any pin_user_pages()- > related problems, enhance dump_page() so as to report the pin count > in that case. > > Documentation/core-api/pin_user_pages.rst is also updated accordingly. > > Cc: Jan Kara > Cc: Kirill A. Shutemov > Cc: Matthew Wilcox > Signed-off-by: John Hubbard > --- > Documentation/core-api/pin_user_pages.rst | 7 +++++++ > mm/debug.c | 21 ++++++++++++++++----- > 2 files changed, 23 insertions(+), 5 deletions(-) > > diff --git a/Documentation/core-api/pin_user_pages.rst b/Documentation/core-api/pin_user_pages.rst > index 5c8a5f89756b..2e939ff10b86 100644 > --- a/Documentation/core-api/pin_user_pages.rst > +++ b/Documentation/core-api/pin_user_pages.rst > @@ -238,6 +238,13 @@ long-term [R]DMA pins in place, or during pin/unpin transitions. > (...unless it was already out of balance due to a long-term RDMA pin being in > place.) > > +Other diagnostics > +================= > + > +dump_page() has been enhanced slightly, to handle these new counting fields, and > +to better report on compound pages in general. Specifically, for compound pages > +with order > 1, the exact (hpage_pinned_refcount) pincount is reported. > + > References > ========== > > diff --git a/mm/debug.c b/mm/debug.c > index f5ffb0784559..2189357f0987 100644 > --- a/mm/debug.c > +++ b/mm/debug.c > @@ -85,11 +85,22 @@ void __dump_page(struct page *page, const char *reason) > mapcount = PageSlab(head) ? 0 : page_mapcount(page); > > if (compound) > - pr_warn("page:%px refcount:%d mapcount:%d mapping:%p " > - "index:%#lx head:%px order:%u compound_mapcount:%d\n", > - page, page_ref_count(head), mapcount, > - mapping, page_to_pgoff(page), head, > - compound_order(head), compound_mapcount(page)); > + if (hpage_pincount_available(page)) { > + pr_warn("page:%px refcount:%d mapcount:%d mapping:%p " > + "index:%#lx head:%px order:%u " > + "compound_mapcount:%d compound_pincount:%d\n", > + page, page_ref_count(head), mapcount, > + mapping, page_to_pgoff(page), head, > + compound_order(head), compound_mapcount(page), > + compound_pincount(page)); > + } else { > + pr_warn("page:%px refcount:%d mapcount:%d mapping:%p " > + "index:%#lx head:%px order:%u " > + "compound_mapcount:%d\n", > + page, page_ref_count(head), mapcount, > + mapping, page_to_pgoff(page), head, > + compound_order(head), compound_mapcount(page)); > + } Have you considered using pr_cont() here. I guess it would be easier to read. You can use my Ack anyway. > else > pr_warn("page:%px refcount:%d mapcount:%d mapping:%p index:%#lx\n", > page, page_ref_count(page), mapcount, > -- > 2.25.0 > -- Kirill A. Shutemov