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=-1.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no 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 5083DC433E1 for ; Thu, 2 Jul 2020 20:39:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D90BE20780 for ; Thu, 2 Jul 2020 20:39:13 +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="IzSkv/l0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D90BE20780 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 233EA6B00C6; Thu, 2 Jul 2020 16:39:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1E3BD6B00C7; Thu, 2 Jul 2020 16:39:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0D4598D0016; Thu, 2 Jul 2020 16:39:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0215.hostedemail.com [216.40.44.215]) by kanga.kvack.org (Postfix) with ESMTP id E93526B00C6 for ; Thu, 2 Jul 2020 16:39:12 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 64B05824556B for ; Thu, 2 Jul 2020 20:39:12 +0000 (UTC) X-FDA: 76994300544.04.step04_191236b26e8c Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin04.hostedemail.com (Postfix) with ESMTP id 3F3A4801691A for ; Thu, 2 Jul 2020 20:39:12 +0000 (UTC) X-HE-Tag: step04_191236b26e8c X-Filterd-Recvd-Size: 6204 Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Thu, 2 Jul 2020 20:39:11 +0000 (UTC) Received: by mail-lj1-f194.google.com with SMTP id f5so18058415ljj.10 for ; Thu, 02 Jul 2020 13:39:11 -0700 (PDT) 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=YJvQeCr5D+7pDpJd4pIV7L8XX+GJqksUNbWa2ylkrsY=; b=IzSkv/l0IpYyCFmm1D5T6LMh7HPu09nGSBEJvN1f+eUjWcsD2cJXf0Eh6b5jj6QLao nvwpYhVCh2Qr6WaIu+AU9fI8ExmpC7LA0Lzth0gDVypZbAuh6YAgKTBpJhzH6sSCyyJP wax2xECJftsXUk0gsruMkFJnMcl/bBpUAMzFhtBDw3wNHHWh9KEFXoO1sY3OT1ODxZ43 69zCaggjW5mWkOQfcGaj6XGp68XOz/56x4rHRol6RJXFtBIqOt6/25w1R+n3vk+LRx9C cd3rn8V9eTT1LCPFqqjmCvBLnaEn3Fu+474uiIP0Emtc7s09JRmhPdoDAbsmYWw7LUk5 jbIQ== 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=YJvQeCr5D+7pDpJd4pIV7L8XX+GJqksUNbWa2ylkrsY=; b=J+GIsE1xpQJY4r3zPyl3ilist7iB9FZLjOSioQ0/coZ5QlZlkK52oWaiq85uoncR5q XH3HZly7/hVUeEyf/L7icuJJ/Xj6px7G4xaMFOeZYzUkmUmVZCgRgI1LGplbBShAeAPB pcp6KByd7pYkQYDYdFoarze8ZIgFUmWIAp2lNJPFJPkdeLsrrKok9xx5xNSimTFnRVuj 7S2U8xq5D+2RRUv+quNPwuwS7s1Q3pHm5dpmHBTl9xOJl/+j8QFIUjJA0a+ySQ+Lu1Lp m5S8HK/bE04Bjo+DXGrTT87+JdFIWRaHmvcBrfBY0p+a7I062Az4fhsezoCbh3fIjCqG Zpaw== X-Gm-Message-State: AOAM533uJYDp3l3EZ7xWaBdw2LfnP2RpBNZynmScs+UKZz50cxRBFjAa yT8kiNGJj3uumFbPJDPPD+rmsA== X-Google-Smtp-Source: ABdhPJziAQSAaWV+Z9L8jcs7jQGOa3Q2hjcjtB4r91VDg2KBd7OK5proT7iVMRzZ9irSqr6rOGm+Ag== X-Received: by 2002:a2e:a58a:: with SMTP id m10mr17113788ljp.346.1593722349920; Thu, 02 Jul 2020 13:39:09 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id d2sm3801927lfq.79.2020.07.02.13.39.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 13:39:08 -0700 (PDT) Received: by box.localdomain (Postfix, from userid 1000) id 6B7BC1018AB; Thu, 2 Jul 2020 23:39:07 +0300 (+03) Date: Thu, 2 Jul 2020 23:39:07 +0300 From: "Kirill A. Shutemov" To: Vlastimil Babka Cc: Matthew Wilcox , John Hubbard , linux-mm@kvack.org, Andrew Morton , "Kirill A. Shutemov" , Mike Kravetz Subject: Re: [PATCH 1/3] mm: Print head flags in dump_page Message-ID: <20200702203907.tgp7eblxquy3zmef@box> References: <20200629151918.15537-1-willy@infradead.org> <20200629151918.15537-2-willy@infradead.org> <20200629225134.GL25523@casper.infradead.org> <29baf5ca-1187-e00a-ee5c-5f08f7b69683@nvidia.com> <49e5da43-88bd-bac5-4dcc-5f5abb0d9a1b@suse.cz> <20200630115950.GM25523@casper.infradead.org> <20200702155336.san26vjcasbnbswy@box> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 3F3A4801691A X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Jul 02, 2020 at 06:19:08PM +0200, Vlastimil Babka wrote: > On 7/2/20 5:53 PM, Kirill A. Shutemov wrote: > > On Thu, Jul 02, 2020 at 04:59:14PM +0200, Vlastimil Babka wrote: > >> On 6/30/20 1:59 PM, Matthew Wilcox wrote: > >> > On Tue, Jun 30, 2020 at 10:02:50AM +0200, Vlastimil Babka wrote: > >> >> I would also prefer this approach.It would be also nice to know the tail index. > >> >> As long as page pointer wasn't hashed, it was possible to figure this out, but > >> >> now it's not. Maybe print pfn of both page and head? > >> > > >> >> On 6/30/20 1:35 AM, John Hubbard wrote: > >> >> > ...so with that fix, along with your line break approach in the other thread, > >> >> > a tail page dump of a FOLL_PIN page looks like this: > >> >> > > >> >> > [ 38.027987] page:00000000abaef9ae refcount:513 mapcount:1 mapping:0000000000000000 index:0x11 > >> > > >> > index is the last thing printed on this line. If it's something like > >> > index:0x12345678, you can reduce it mod 1< >> > line. > >> > >> Hmm, I guess that works as long as head pages really have index aligned to 1 << > >> order ... they should, right? > >> > >> But does it fail for HugeTLB? CC Kirill (git blamed) and Mike. > >> page_to_pgoff() has for PageHeadHuge this: > >> return page->index << compound_order(page) > >> > >> but page_to_index() does simply > >> pgoff = compound_head(page)->index; > >> pgoff += page - compound_head(page); > >> > >> Shouldn't it also do a < > > > PageHeadHuge() is only true for head pages, so we are fine here. > > Really? We are calculatting index (pgoff) of tail page, which should be index of > head page plus n for n'th tail page; the unit is base pages. > But ff HugeTLB head pages use the unit of huge page in page->index, and > page_to_pgoff() translates it to unit of base pages, then we should do the same > when calculating the index of tail page, no? Otherwise we are adding up units of > huge pages (from head->index) with units of base page (n'th tail) and get > garbage as a result, AFAICS? You are right. I guess we can get away with this because nobody calls page_to_pgoff() on tail pages of hugetlb page. Except when something goes wrong and dump_page() has to deal with it. I'm not sure if it's worth fixing and whether the fix should be inside page_to_pgoff(). The best fix would be to remove hugetlb pages special-casing: it has to have ->index in base pagesize, not huge page. -- Kirill A. Shutemov