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=-8.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 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 77143C433DB for ; Thu, 11 Feb 2021 19:39:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 188B564E3D for ; Thu, 11 Feb 2021 19:39:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 188B564E3D 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 87ED06B0157; Thu, 11 Feb 2021 14:39:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 82F3D6B0158; Thu, 11 Feb 2021 14:39:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 745FE6B0159; Thu, 11 Feb 2021 14:39:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0042.hostedemail.com [216.40.44.42]) by kanga.kvack.org (Postfix) with ESMTP id 5C18B6B0157 for ; Thu, 11 Feb 2021 14:39:22 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 13415181AF5C3 for ; Thu, 11 Feb 2021 19:39:22 +0000 (UTC) X-FDA: 77807000964.10.egg72_25073482761b Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin10.hostedemail.com (Postfix) with ESMTP id D491C16A4C0 for ; Thu, 11 Feb 2021 19:39:21 +0000 (UTC) X-HE-Tag: egg72_25073482761b X-Filterd-Recvd-Size: 5118 Received: from mail29.static.mailgun.info (mail29.static.mailgun.info [104.130.122.29]) by imf27.hostedemail.com (Postfix) with ESMTP for ; Thu, 11 Feb 2021 19:39:19 +0000 (UTC) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1613072361; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=7ZShCPlqDj9fscjkgLTRVv6M92I9n+gZhGfFsm84qH4=; b=j3G8my5Sy6B4zzU7/QxmFx7T4sVm55MG/0RGEubK85TcTCVWSgz2DnY3nv2JfKZZ8au+mMYd 8bDNJ81mxDhZFAhieRoSokK0TLYRnIn9lnKB59+ReDMHig61j3iCfAzXa2UryWEvFjWRMYxd VDMgFeN0NL0jgiLMjChfvVDxsmU= 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-n05.prod.us-east-1.postgun.com with SMTP id 602587dbe4842e9128fe4f02 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Thu, 11 Feb 2021 19:39:07 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id CF72EC43465; Thu, 11 Feb 2021 19:39:06 +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 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 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-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