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=-11.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 BA6C8C433DB for ; Tue, 2 Feb 2021 06:56:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C54CF64EE1 for ; Tue, 2 Feb 2021 06:55:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C54CF64EE1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id F40576B0093; Tue, 2 Feb 2021 01:55:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EF04D6B0095; Tue, 2 Feb 2021 01:55:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DB8406B0096; Tue, 2 Feb 2021 01:55:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0122.hostedemail.com [216.40.44.122]) by kanga.kvack.org (Postfix) with ESMTP id C6F256B0093 for ; Tue, 2 Feb 2021 01:55:57 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 92B098249980 for ; Tue, 2 Feb 2021 06:55:57 +0000 (UTC) X-FDA: 77772417954.19.glove34_55036c9275c8 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin19.hostedemail.com (Postfix) with ESMTP id 779EF1AD1B0 for ; Tue, 2 Feb 2021 06:55:57 +0000 (UTC) X-HE-Tag: glove34_55036c9275c8 X-Filterd-Recvd-Size: 4358 Received: from mail29.static.mailgun.info (mail29.static.mailgun.info [104.130.122.29]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Tue, 2 Feb 2021 06:55:56 +0000 (UTC) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1612248956; h=Message-Id: Date: Subject: Cc: To: From: Sender; bh=mPwEiG7lR6/N/+INJTDsDxIcCXE0CuohFiHjM7roeUk=; b=Q1ADtG7OoE6t+dnAcB0VhJFRzRtYRO8hmHgZxSJhT0eiBOmwMbqsuJsYksdYqCu18wiDcSwj 2sXtuEwxUAKKzgaZ1tGF6cX7ap2laSQ4K/euUKxtePfnO8WOrYPSb1HuXB4jW6BEO38/B8fm APZeV/CbjSrwbv4EPgOKP808UiY= X-Mailgun-Sending-Ip: 104.130.122.29 X-Mailgun-Sid: WyIwY2Q3OCIsICJsaW51eC1tbUBrdmFjay5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n06.prod.us-east-1.postgun.com with SMTP id 6018f77b8f2d32c2c508ef90 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 02 Feb 2021 06:55:55 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 12CC3C433C6; Tue, 2 Feb 2021 06:55:55 +0000 (UTC) Received: from cgoldswo-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: cgoldswo) by smtp.codeaurora.org (Postfix) with ESMTPSA id 013C9C433CA; Tue, 2 Feb 2021 06:55:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 013C9C433CA Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=cgoldswo@codeaurora.org From: Chris Goldsworthy To: Andrew Morton , Alexander Viro Cc: Minchan Kim , Matthew Wilcox , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Chris Goldsworthy Subject: [RFC] Invalidate BH LRU during page migration Date: Mon, 1 Feb 2021 22:55:46 -0800 Message-Id: X-Mailer: git-send-email 2.7.4 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: A page containing buffer_heads can be pinned if any of its constituent buffer_heads belongs to the BH LRU cache [1]. After going through several iterations of a patch that attempts to solve this by removing BH entries inside of the drop_buffers() function, which in the worst-case could be called for each migrated page, Minchan Kim suggested that we invalidate the entire BH LRU once, just before we start migrating pages. Additionally, Matthew Wilcox suggested that we invalidate the BH LRU inside of lru_add_drain_all(), so as to benefit functions like other functions that would be impacted by pinned pages [2]. TODO: - It should be possible to remove the initial setting of bh_migration_done = false; in migrate_prep by passing this in as a parameter to invalidate_bh_lru(), but we'd still need a matching bh_migration_done = true; call. - To really benefit other callers of lru_add_drain_all() other than __alloc_contig_migrate_range() in the CMA allocaiton path, we'd need to add additional calls of bh_migration_done = false; [1] https://elixir.bootlin.com/linux/latest/source/fs/buffer.c#L1238 [2] https://lore.kernel.org/linux-fsdevel/cover.1611642038.git.cgoldswo@codeaurora.org/ Chris Goldsworthy (1): [RFC] mm: fs: Invalidate BH LRU during page migration fs/buffer.c | 6 ++++++ include/linux/buffer_head.h | 3 +++ include/linux/migrate.h | 2 ++ mm/migrate.c | 18 ++++++++++++++++++ mm/page_alloc.c | 3 +++ mm/swap.c | 3 +++ 6 files changed, 35 insertions(+) -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project