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=ham 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 632E6C3F68F for ; Tue, 11 Feb 2020 13:21:45 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 10B89206DB 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" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 10B89206DB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id AE12C6B02CD; Tue, 11 Feb 2020 08:21:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A90886B02CF; Tue, 11 Feb 2020 08:21:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 97F4F6B02D0; Tue, 11 Feb 2020 08:21:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0211.hostedemail.com [216.40.44.211]) by kanga.kvack.org (Postfix) with ESMTP id 80BEF6B02CD for ; Tue, 11 Feb 2020 08:21:44 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 2E6AF246A for ; Tue, 11 Feb 2020 13:21:44 +0000 (UTC) X-FDA: 76477908528.30.drain80_2c29526862b5a X-HE-Tag: drain80_2c29526862b5a X-Filterd-Recvd-Size: 7032 Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) by imf40.hostedemail.com (Postfix) with ESMTP for ; Tue, 11 Feb 2020 13:21:43 +0000 (UTC) Received: by mail-lf1-f66.google.com with SMTP id f24so6989281lfh.3 for ; Tue, 11 Feb 2020 05:21:43 -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=XzPVUJRWuMppdW3MZfgfJFpCwVal7r9Nv96OlvfyadA/MDHEP1oZ4lE1s8GM4y/NSv Z+zORdEHKnizT9Pg1YFDQP8iX3g1I4x4Yx1Oi3gLI3OWv3BNwFhlYpavKeuItex6V6wk mxEIav5uEBCD+oJjh9Z59iNNUzFB1oOEviqntaFsm8r9OGzgOZWQwklaaf2p86y+hUfM WZDSfw40yvjN4AFeL3I/+VK/EkCyj/KVF+DvveVCrl7OjCHhN/9IcMTj6WJHdaFbQt/i nBREI3NdwQqKJ5ww6brS6krWyyFqgOrWfoDPPGhPl/NYkNeYPyBdruLHyCvSuA9dG8fX rB7w== X-Gm-Message-State: APjAAAURdX+Py5s4TTvnMEzb6NN56Fdu62gLCo3w7wPYoVb9yOWx66W7 ar9ZD6/wG+xfNEAfNHP74GmJJA== 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> 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: 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