From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00D08C3B186 for ; Tue, 11 Feb 2020 13:21:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CD05C214DB for ; Tue, 11 Feb 2020 13:21:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=shutemov-name.20150623.gappssmtp.com header.i=@shutemov-name.20150623.gappssmtp.com header.b="bFc+jsaX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728573AbgBKNVp (ORCPT ); Tue, 11 Feb 2020 08:21:45 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:41247 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729018AbgBKNVp (ORCPT ); Tue, 11 Feb 2020 08:21:45 -0500 Received: by mail-lf1-f68.google.com with SMTP id m30so6973071lfp.8 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=kcuoHLGv9jj+225ww1IFGzxgNkMHB0C2fnOmXRrs3AOFgXPMpJNa0he+zBhx/09NOJ ORvl0YPcJ4tEIwo0j/nGqDNX9yHrSYC8kn8M4PG9AnEciZVnJWesQuGH2MOAUmyVScQI HYvm6Oi9ZKt4vO1QoUXAGBRaYHFxx1/v2rPQ+JbJK35nL2ODJ8rfG7d05oTS6i2fij2X s5wYSY2ov1oNXqvyTbHY+KJ3fBftQ0IbBdSSd7utl14cALB/17X2te/KCVemYW/ayqmi mes+lEgabW1XeC+W8tXggVv1ebR1TZWls16NdDHkBbZJFYiORlQSKW/Gyyjq0WCMMDVw NZMA== X-Gm-Message-State: APjAAAXfe4Z9FKShfep8lsadYxojc1hREfZvMPwVVlZ3yDYvVzhiesi8 c9P9okllwxF2MmAXlWzbX+X4kA== X-Google-Smtp-Source: APXvYqxV3rctot+0vYRe7IkamEeOz1L1i7WPyibLsi5dvBCjvN0112ivhIa5RgpfbLebu0hWGg8rAw== 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-doc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-doc@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