Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2414428pxb; Thu, 11 Feb 2021 11:41:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJxGAIIQmkYX58HwZSRtY/E1zw4iaYO/fh88+9hNkyvS4CqWS6LnZx8+fykiTVviRivGpnKO X-Received: by 2002:aa7:c94c:: with SMTP id h12mr10057754edt.40.1613072493088; Thu, 11 Feb 2021 11:41:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613072493; cv=none; d=google.com; s=arc-20160816; b=q8cWqa88OFWwpTr6/BdfuwCWbLuxQ1bGMfWzI8gR+8/UfhS3zs5/efOE0J5zUeZKzk AK73Op3FnlnC6S5yOxlojOLQP8Pj8r9Pl5eTF3fPcjtbuSbQ3V90PfwYROePRDcSK+/s W4PdEyfgWFs9nd+cWW2lNhNMsZmXNUMdfgWZmqqQ/Gnmn5DlZ72WUl16LHgFgFU72q+s nvUAm/7ACo/rv/+Xa2Dd+JfSnoj2PP/03Q/+L1YLSyovQX5WFmY3dyCP9FmHb7W+wKX4 NKegGfKjqEPzNmYkS2d+lorg+s1cH4ss2xJM2l84YhD2PsFbimwrRasIuuVoF50cklG6 ZnKQ== 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=7ZShCPlqDj9fscjkgLTRVv6M92I9n+gZhGfFsm84qH4=; b=t5JmW4VEGs7QhkpbDAwDWSR1ZhexCiQZcnvfQfpihHpK5BfCQavn1zNpi7fHWFIihU XG9OZAiWPVWvIElMjc2AOTLe8DQhiPZVMz11ZEm+8nr3z/9kuHADPgC+u/HjKE7pgbO4 YvLK6vWZAYkK72sTERyEF7RviiYdSQdh414BLvFsNxDp1oUxkocwK+jS6ahciMZTSveZ l+GUaXxDXACN16ShJFeIL3a0isb/zYMJUcaUMC89iil3gDW9fgTs0H65IoCX+zpEe+wV kbcF+Yohjtb6eL7nfNKacibxO9hFPiKMOmoeiZ/DvTnebMkge/aSNDm3iwdGiwSHgilA ehNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=Sf6KUk9r; 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 r21si4972438ejo.142.2021.02.11.11.41.08; Thu, 11 Feb 2021 11:41:33 -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=Sf6KUk9r; 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 S230147AbhBKTkD (ORCPT + 99 others); Thu, 11 Feb 2021 14:40:03 -0500 Received: from so15.mailgun.net ([198.61.254.15]:32068 "EHLO so15.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229731AbhBKTkA (ORCPT ); Thu, 11 Feb 2021 14:40:00 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1613072380; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=7ZShCPlqDj9fscjkgLTRVv6M92I9n+gZhGfFsm84qH4=; b=Sf6KUk9r13x/K/87AvTpzwVFoKZf39NIZOTjtFno3OQVnPXUGdFs8lZep3Jmbgb40V+20wEr glfygx4SJjvwLqVeKAilpUx/wBnmq2MMKokByuTG6z2setCcEFXFBetKP/rDOfwfjLkqKr/c uSxYNzphzwl+zHNknDu3ThKmI9k= X-Mailgun-Sending-Ip: 198.61.254.15 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-n06.prod.us-west-2.postgun.com with SMTP id 602587dbf112b7872cc26a7c (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Thu, 11 Feb 2021 19:39:07 GMT Sender: cgoldswo=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id A864EC43461; Thu, 11 Feb 2021 19:39:06 +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 984C3C433CA; Thu, 11 Feb 2021 19:39:05 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 11 Feb 2021 11:39:05 -0800 From: Chris Goldsworthy To: Matthew Wilcox Cc: Andrew Morton , Alexander Viro , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Minchan Kim Subject: Re: [PATCH v2] [RFC] mm: fs: Invalidate BH LRU during page migration In-Reply-To: <20210211140950.GJ308988@casper.infradead.org> References: <20210211140950.GJ308988@casper.infradead.org> Message-ID: <60485ac195c0b1eecac2c99d8bca7fcb@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-02-11 06:09, Matthew Wilcox wrote: > On Wed, Feb 10, 2021 at 09:35:40PM -0800, Chris Goldsworthy wrote: >> +/* These are used to control the BH LRU invalidation during page >> migration */ >> +static struct cpumask lru_needs_invalidation; >> +static bool bh_lru_disabled = false; > > As I asked before, what protects this on an SMP system? > Sorry Matthew, I misconstrued your earlier question in V1, and thought you had been referring to compile-time protection (so as to prevent build breakages). It is not protected, so I'll need to change this into an atomic counter that is incremented and decremented by bh_lru_enable() and bh_lru_disable() respectively (such that if the counter is greater than zero, we bail). >> @@ -1292,7 +1296,9 @@ static inline void check_irqs_on(void) >> /* >> * Install a buffer_head into this cpu's LRU. If not already in the >> LRU, it is >> * inserted at the front, and the buffer_head at the back if any is >> evicted. >> - * Or, if already in the LRU it is moved to the front. >> + * Or, if already in the LRU it is moved to the front. Note that if >> LRU is >> + * disabled because of an ongoing page migration, we won't insert bh >> into the >> + * LRU. > > And also, why do we need to do this? The page LRU has no equivalent > mechanism to prevent new pages being added to the per-CPU LRU lists. > If a BH has just been used, isn't that a strong hint that this page is > a bad candidate for migration? I had assumed that up until now, that pages in the page cache aren't an issue, such that they're dropped during migration as needed. Looking at try_to_free_buffers[1], I don't see any handling for the page cache. I will need to do due diligence and follow up on this. As for the question on necessity, if there is a case in which preventing buffer_heads from being added to the BH LRU ensures that the containing page can be migrated, then I would say that the change is justified, since adds another scenario in which migration is guaranteed (I will follow up on this as well). Regards, Chris. [1] https://elixir.bootlin.com/linux/latest/source/fs/buffer.c#L3225 -- The Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project