Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp821833pxb; Thu, 28 Jan 2021 00:35:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJzlIZGc3MY+4Hb4wsPWUbvJZz7wER0eqiNkCzPzZUT+5S3K3F5Y4UOCZlXPtUEyvWQ4s2CE X-Received: by 2002:a17:906:eb46:: with SMTP id mc6mr10164656ejb.184.1611822909300; Thu, 28 Jan 2021 00:35:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611822909; cv=none; d=google.com; s=arc-20160816; b=gmvrMuFfIO1t/6JU/QGE+AFOD1q1nxrNvcSDBcBGfiXw7bXhV3BwTdvIdOaBRt+6Ny xB7M09hAPXYSyvcPnBCfNMl47GwIYzT/LYWusB8/BxGmctqSmPVuRIICyaI4OTTKyCr9 Q6VIWPuGiNyt0/WsN5NU4sNk3qvAyoqKcDRLzvl+QBJejxE2WHYeCeC2eKbfBD588gH/ EFwOvreoXPLzWoKR962jY355rN/YJHuOibODHu/w8AzHnS8Cm578IWmaULPxeSDiR8Ym toXMdOHKeAirT4ko4tjEahQLuZCtcUrbGfnBEyVTKECVxNsgsC8hJawljU4JndrNaPvD 8xZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:message-id:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :sender:dkim-signature; bh=MbkdEBTiLbx2Jy1T3KIYQ0dnm89j4PVd4XxznmeHnOs=; b=Jy/bpgOxZm6lhDukKmzzCKSxV90w0fX6J26uUmpG12KbbipGkuRzjJa0qaOVrX/Z3L bzwkpMygWjstiVZ1pJshsontSe5ARTeBLYxXBNlXB9DsobV3bdz5PZstrJ70DlrJHYZz 2behJBvnpT3gmK9d0sol6pxysk9QdwaGpteURQZ/zG8qAM0E5SGpnQeOKxbFkstEIY4y lMSeN4/WhVcvKPTXLzax4pTZMc+yAMyKp/UgB2suIwjPYKVUlKicWCx94vMteI6Vd+8P r8RROaSjoDPQNGONfLhiswnAj/VTzOzl1Vb1jdnRJkPmKN2rQXoen35Pyrp1/KYU61eK Mo6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=hpqmx0bh; 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 hh14si2127078ejb.457.2021.01.28.00.34.45; Thu, 28 Jan 2021 00:35:09 -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=@mg.codeaurora.org header.s=smtp header.b=hpqmx0bh; 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 S231336AbhA1I3c (ORCPT + 99 others); Thu, 28 Jan 2021 03:29:32 -0500 Received: from a1.mail.mailgun.net ([198.61.254.60]:49654 "EHLO a1.mail.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231158AbhA1I3b (ORCPT ); Thu, 28 Jan 2021 03:29:31 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1611822548; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=MbkdEBTiLbx2Jy1T3KIYQ0dnm89j4PVd4XxznmeHnOs=; b=hpqmx0bhhIJ8Gnlg+LNp3BG7c/1qiMt9Sr8CFF/AGjz7mpVFOSHVZhiwG8MKnaWGkkg9bHss td/aFnscAPuysfLN4peSjGAGB4DwCv6yLQ+XKyzOZyB9XTsSwHZlqGvkxnUY3cIzRTj7FTON 0NfgNujQVGsmNOqRj/WklPR/Evs= X-Mailgun-Sending-Ip: 198.61.254.60 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n01.prod.us-east-1.postgun.com with SMTP id 601275b7e325600642851a43 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Thu, 28 Jan 2021 08:28:39 GMT Sender: cgoldswo=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 76A01C43465; Thu, 28 Jan 2021 08:28:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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