Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp677497pxb; Thu, 12 Nov 2020 13:31:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJxXXGdWW8VeI8KV01K8Gv7nFeXevWEPU07avwx0uU/XcvW1bJbpJDpXpoFS9xbKL2oDvUk1 X-Received: by 2002:a05:6402:3064:: with SMTP id bs4mr2106054edb.258.1605216668788; Thu, 12 Nov 2020 13:31:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605216668; cv=none; d=google.com; s=arc-20160816; b=YjzXoAo7kHHaruIEwNf9yc52vW7pCFYIhjIOxtZwmI9ssc9do1TvUfSyT0HqChn0M7 GGumosykTa2F0opyVb8vbKR4eJEObSDAvGuhfINaGUtjSeVItnXYTTWdUxERHN8Rlboi uXw7Cbphzee1xV/Qpi77J52TSUgrAkfB26PV9fbqo/xHbozuj2C+nHUp1dC/hOd+oJ1V zm28qzpFOml+kdWMhvEIaawbOLALYrPB3hZoV2qnHoYP7Kf/0KqnfI59pXLxEK69fuOF /QCpP4jz6FXxvA0I2D8vlIiSkY4imJ30PFSjKJKk5VzT1EgQfrOAcXL7/xY4HtwAjDwt B6SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hHTBK4BYPzK5sxPr2WzuBNxW83FIC+F2fBOyFQf+0ws=; b=FfNAen7peap/6saGBJIYr8dsq01lmj/46Ylxr0FCzeMKwRRgc2v1iX+WuqD494y+Yr O6NtC2qPp45vsTdYgTtFZRnX/6fwOp0UwYsH4EGnrOlMG/3al6La+qC8E0nm58aNnsaR RLIwdNsH+rF+0LB23kSLcuTBo3MlC/N3Gd4abmrBzgH2u5VTvvqGKet77Lf3oy41ChdB dybFlsN5IezvTzTirYZ/ToH3w03tfg+qpMOW9U9A+oIeZlsqUEADv2XAz/Z1H0Ed6Fmu hBsRGN24APtRKLgxOwxBrhhXHKv/SePpUAq4BP3zwJ/Iy760kqlYsZRHRvIHQMkqLpBT 26nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=NXmVbUS7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dm25si4497529edb.238.2020.11.12.13.30.44; Thu, 12 Nov 2020 13:31:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=NXmVbUS7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727392AbgKLV0t (ORCPT + 99 others); Thu, 12 Nov 2020 16:26:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726963AbgKLV0t (ORCPT ); Thu, 12 Nov 2020 16:26:49 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3EA4C0613D1; Thu, 12 Nov 2020 13:26:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=hHTBK4BYPzK5sxPr2WzuBNxW83FIC+F2fBOyFQf+0ws=; b=NXmVbUS7kRm/236rRSQxvtyc2U ZZHRvCkKVgQjP/gVzR/xk/YlN5IHiVxBG0u+WMV5uEX2gjlgQ73lS/hgOm1Ha4Rs/6O+uRjHC+CLq fmShrL0C1mKrjpFXW77suorHT+7Kkl9bUcF9BCkdjqUr/ycSP8+qRzJzauuWslNUTX8GZy5VLNPTz piHbKC5WBneycVJN40+v62WUOGcRQpiMw1Hm4QK/mFyUHiIer9DD6yFQ4bhzkYe7eopd7TtwLC/Xl bzf26tY7NklsxMfzn85KbmdBIIqRMLBdnc7hgs3MojXF5HgJuESEIXUEA/hBj/XGmXroZuuIB8EFO Joy1oLtQ==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdK79-0007G4-NF; Thu, 12 Nov 2020 21:26:43 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" , akpm@linux-foundation.org, hughd@google.com, hch@lst.de, hannes@cmpxchg.org, yang.shi@linux.alibaba.com, dchinner@redhat.com, linux-kernel@vger.kernel.org, Jan Kara , William Kucharski Subject: [PATCH v4 01/16] mm: Make pagecache tagged lookups return only head pages Date: Thu, 12 Nov 2020 21:26:26 +0000 Message-Id: <20201112212641.27837-2-willy@infradead.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20201112212641.27837-1-willy@infradead.org> References: <20201112212641.27837-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Pagecache tags are used for dirty page writeback. Since dirtiness is tracked on a per-THP basis, we only want to return the head page rather than each subpage of a tagged page. All the filesystems which use huge pages today are in-memory, so there are no tagged huge pages today. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Jan Kara Reviewed-by: William Kucharski --- mm/filemap.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 249cf489f5df..bb6f2ae5a68c 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2066,7 +2066,7 @@ unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t index, EXPORT_SYMBOL(find_get_pages_contig); /** - * find_get_pages_range_tag - find and return pages in given range matching @tag + * find_get_pages_range_tag - Find and return head pages matching @tag. * @mapping: the address_space to search * @index: the starting page index * @end: The final page index (inclusive) @@ -2074,8 +2074,9 @@ EXPORT_SYMBOL(find_get_pages_contig); * @nr_pages: the maximum number of pages * @pages: where the resulting pages are placed * - * Like find_get_pages, except we only return pages which are tagged with - * @tag. We update @index to index the next page for the traversal. + * Like find_get_pages(), except we only return head pages which are tagged + * with @tag. @index is updated to the index immediately after the last + * page we return, ready for the next iteration. * * Return: the number of pages which were found. */ @@ -2109,9 +2110,9 @@ unsigned find_get_pages_range_tag(struct address_space *mapping, pgoff_t *index, if (unlikely(page != xas_reload(&xas))) goto put_page; - pages[ret] = find_subpage(page, xas.xa_index); + pages[ret] = page; if (++ret == nr_pages) { - *index = xas.xa_index + 1; + *index = page->index + thp_nr_pages(page); goto out; } continue; -- 2.28.0