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=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 67FEBC433E0 for ; Thu, 28 Jan 2021 08:28:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B07EC64D9D for ; Thu, 28 Jan 2021 08:28:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B07EC64D9D 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 C21D56B0072; Thu, 28 Jan 2021 03:28:48 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BD2796B0073; Thu, 28 Jan 2021 03:28:48 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AE89C6B0074; Thu, 28 Jan 2021 03:28:48 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0177.hostedemail.com [216.40.44.177]) by kanga.kvack.org (Postfix) with ESMTP id 9503D6B0072 for ; Thu, 28 Jan 2021 03:28:48 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 53DC53626 for ; Thu, 28 Jan 2021 08:28:48 +0000 (UTC) X-FDA: 77754507936.03.rifle13_3a031222759e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id 2A4B728A4E8 for ; Thu, 28 Jan 2021 08:28:48 +0000 (UTC) X-HE-Tag: rifle13_3a031222759e X-Filterd-Recvd-Size: 4825 Received: from m42-8.mailgun.net (m42-8.mailgun.net [69.72.42.8]) by imf42.hostedemail.com (Postfix) with ESMTP for ; Thu, 28 Jan 2021 08:28:45 +0000 (UTC) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1611822527; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=MbkdEBTiLbx2Jy1T3KIYQ0dnm89j4PVd4XxznmeHnOs=; b=cYfu32PwPympXBytcJSRsbcRkFUnA2GESyEtJd0gTrMelyZE88OhmVAtiRiPeZxt8qHbiXp+ DeMWwd98iEGXGoKx1hgWWjNgaJnTODLjxOFDxbkMb3nFhlH37tbaz4fGJUFgWXl3uJdbKS0N fXJbS/Dq8jY94veK1KM4WWTt39g= X-Mailgun-Sending-Ip: 69.72.42.8 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-n03.prod.us-west-2.postgun.com with SMTP id 601275b69137d6636d779d72 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Thu, 28 Jan 2021 08:28:38 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 6BE84C43463; Thu, 28 Jan 2021 08:28:38 +0000 (UTC) Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: cgoldswo) by smtp.codeaurora.org (Postfix) with ESMTPSA id 3B5AFC433C6; Thu, 28 Jan 2021 08:28:37 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 28 Jan 2021 00:28:37 -0800 From: Chris Goldsworthy To: Matthew Wilcox Cc: Minchan Kim , viro@zeniv.linux.org.uk, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Laura Abbott Subject: Re: [PATCH v4] fs/buffer.c: Revoke LRU when trying to drop buffers In-Reply-To: <20210127025922.GS308988@casper.infradead.org> References: <20210127025922.GS308988@casper.infradead.org> Message-ID: <4d034ea4228be568db62243bfe238e0d@codeaurora.org> X-Sender: cgoldswo@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 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 2021-01-26 18:59, Matthew Wilcox wrote: > On Tue, Jan 26, 2021 at 02:59:17PM -0800, Minchan Kim wrote: >> The release buffer_head in LRU is great improvement for migration >> point of view. >> >> A question: Hey guys, >> Can't we invalidate(e.g., invalidate_bh_lrus) bh_lru in migrate_prep >> or >> elsewhere when migration found the failure and is about to retry? >> >> Migration has done such a way for other per-cpu stuffs for a long >> time, >> which would be more consistent with others and might be faster >> sometimes >> with reducing IPI calls for page. > Should lru_add_drain_all() also handle draining the buffer lru for all > callers? A quick survey ... > > invalidate_bdev() already calls invalidate_bh_lrus() > compact_nodes() would probably benefit from the BH LRU being > invalidated > POSIX_FADV_DONTNEED would benefit if the underlying filesystem uses BHs > check_and_migrate_cma_pages() would benefit > khugepaged_do_scan() doesn't need it today > scan_get_next_rmap_item() looks like it only works on anon pages (?) so > doesn't need it > mem_cgroup_force_empty() probably needs it > mem_cgroup_move_charge() ditto > memfd_wait_for_pins() doesn't need it > shake_page() might benefit > offline_pages() would benefit > alloc_contig_range() would benefit > > Seems like most would benefit and a few won't care. I think I'd lean > towards having lru_add_drain_all() call invalidate_bh_lrus(), just to > simplify things. Doing this sounds like a good idea. We would still need a call to invalidate_bh_lrus() inside of drop_buffers() in the event that we find busy buffers, since they can be re-added back into the BH LRU - I believe it isn't until this point that a BH can't be added back into the BH LRU, when we acquire the private_lock for the mapping: https://elixir.bootlin.com/linux/v5.10.10/source/fs/buffer.c#L3240 Thanks, Chris. -- The Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project