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, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS 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 EC0DBC3F2C6 for ; Tue, 3 Mar 2020 21:28:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9D7DC208C3 for ; Tue, 3 Mar 2020 21:28:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="pVykgex9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9D7DC208C3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 44FB06B0005; Tue, 3 Mar 2020 16:28:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4005A6B0006; Tue, 3 Mar 2020 16:28:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 33C836B0007; Tue, 3 Mar 2020 16:28:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0100.hostedemail.com [216.40.44.100]) by kanga.kvack.org (Postfix) with ESMTP id 1C4906B0005 for ; Tue, 3 Mar 2020 16:28:26 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 654838248D51 for ; Tue, 3 Mar 2020 21:28:25 +0000 (UTC) X-FDA: 76555339770.08.toes71_83bcb25b59426 X-HE-Tag: toes71_83bcb25b59426 X-Filterd-Recvd-Size: 4823 Received: from mail-il1-f193.google.com (mail-il1-f193.google.com [209.85.166.193]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Tue, 3 Mar 2020 21:28:25 +0000 (UTC) Received: by mail-il1-f193.google.com with SMTP id r4so68083iln.0 for ; Tue, 03 Mar 2020 13:28:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=dDblrfpIwbGBAZMPriYgG1lZiS3Ykmw8smPe8rMZXPE=; b=pVykgex90pwV95ls/8qAvTCJZ/y9S5nqqHMPqcJTIFNOcTSFggV8fLfMIeaEaNxEkK BXELdXUIirJqW2EZuUzDIcJ1W0soWQ7fYInaGBTcrJ/5NLgUVAeRTFOk1RKrbdF1gNZS puMhijgKRNMHjksQpQHCueYkmDvbrfGMTpgt9SB5XeIkU5t4OafcYKGK5lg8QHohQBPO rmyc7mHIl4rjz+ShRKbPWdd42rmtFuQWAh/pAbG/4BmWklRA1hDyp5ySuGR1dHmbhqk1 n3fRwWZAwDkQVMVHF+WYQoL1ZPZN5fL7iyidiJ99dFlDC2RuxceDFPFaBLVkoj+huexa V7gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dDblrfpIwbGBAZMPriYgG1lZiS3Ykmw8smPe8rMZXPE=; b=PCQuMJa/IoPlBZAlRaxEE0aIdn/jciVV7p7KzgVIgr3+xtYScmDp5ssx572rpthuwy Jr+LFwF89tZJanvoJvT4+07SSOxWlw5wzI2jnFhtocQdqYTmsTcvtm4MaZ4zVAdN8lk2 yH+8fPxFoNMFVEqO5ClRNAmRxm02sZcOkFCorRkumneRz6y2Kt9SaoM4q0nTL1iBIx2h ERO73LH5hQjn7VCm2D/UK5SFX1S8LcBNH9S4X3pqwwk2y7/b4jrn2JFbZ+8DwJJrWhty Z6+Bbq4E2ed3CxtTgnjz0IpFTZq57K3yIm/vwZXsgCRqYgA5DZ+OJg7Q/evudjZ3pLv6 KKDQ== X-Gm-Message-State: ANhLgQ1eatEcmKKTOqXj+RyuGpn48FrnTadVwcSuugu4/jOYoUi+OvRm NoBqaJO/YDwXwz05W6U+l6TGOjzeF+f+6ojkEJI= X-Google-Smtp-Source: ADFU+vtpAAWxWWI45cfO5JvIUSS6eRXcn3628FnL31/ET9LPO6L3cTJlC5KgHB1f2RLTcSBlrw3Ij7baXrtyqTw3uRg= X-Received: by 2002:a92:d608:: with SMTP id w8mr6407075ilm.95.1583270904600; Tue, 03 Mar 2020 13:28:24 -0800 (PST) MIME-Version: 1.0 References: <20200303041125.19358-1-willy@infradead.org> <20200303041125.19358-3-willy@infradead.org> In-Reply-To: <20200303041125.19358-3-willy@infradead.org> From: Alexander Duyck Date: Tue, 3 Mar 2020 13:28:13 -0800 Message-ID: Subject: Re: [PATCH 2/6] mm: Optimise find_subpage for !THP To: Matthew Wilcox Cc: linux-mm , "Kirill A . Shutemov" Content-Type: text/plain; charset="UTF-8" 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, Mar 2, 2020 at 8:11 PM Matthew Wilcox wrote: > > From: "Matthew Wilcox (Oracle)" > > If THP is disabled, find_subpage can become a no-op. > > Signed-off-by: Matthew Wilcox (Oracle) > Acked-by: Kirill A. Shutemov > --- > include/linux/pagemap.h | 15 ++++++++++----- > 1 file changed, 10 insertions(+), 5 deletions(-) > > diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h > index b4ea3a5d00e5..8785f60b05f8 100644 > --- a/include/linux/pagemap.h > +++ b/include/linux/pagemap.h > @@ -333,14 +333,19 @@ static inline struct page *grab_cache_page_nowait(struct address_space *mapping, > mapping_gfp_mask(mapping)); > } > > -static inline struct page *find_subpage(struct page *page, pgoff_t offset) > +/* > + * Given the page we found in the page cache, return the page corresponding > + * to this offset in the file > + */ > +static inline struct page *find_subpage(struct page *head, pgoff_t offset) > { > - if (PageHuge(page)) > - return page; > + /* HugeTLBfs wants the head page regardless */ > + if (PageHuge(head)) > + return head; > > - VM_BUG_ON_PAGE(PageTail(page), page); > + VM_BUG_ON_PAGE(PageTail(head), head); Is there any specific reason for renaming page to head? Just wondering since it adds some noise to the patch that wasn't really called out in the patch description. From what I can tell none of the changes above this point have any explanation to them in the patch description, and until I noticed the change below I thought maybe you had the wrong patch description for this patch. > - return page + (offset & (compound_nr(page) - 1)); > + return head + (offset & (hpage_nr_pages(head) - 1)); > } So the patch description refers to this line here, correct? One thing I am noticing is that it looks like the VM_BUG_ON_PAGE is now redundant. If I am not not mistaken hpage_nr_pages will call PageTransHuge which also performs the same check. So do you still need the VM_BUG_ON_PAGE call in this function?