Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp4097658pxt; Tue, 10 Aug 2021 20:15:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGZixMpgKwBgTjq2hoHyQLxGCwdlgiFJ2Xy9ZJKDLtK5BTrpBwS123Iuimdlrhka0Ars/Y X-Received: by 2002:a05:6402:caf:: with SMTP id cn15mr8710441edb.236.1628651718903; Tue, 10 Aug 2021 20:15:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628651718; cv=none; d=google.com; s=arc-20160816; b=a83l2G09kIb9kM/ClQ8W9wbeu2UdlBKL5TKfQ8+/X8O5CTou7Ou3V5UUxLKkcgrOa/ geoJUxEtaKjtSuS+KkTpvWns+bsl8AyGXc3r/unvBSlbL8Aff1FgcH3rsAaPVSIJbWAV dXkhZFBpgkTuGCFVcRpwstp09DcbP8zMbTksURypKyTw9HPKgDvSRLMO5vRQ84xeYmIb 5z/las5eR2GJsJxv/relz9mpABt/P+REi2dhvj1RWT/HKRShZjxhUu0HoKwanI12zrnZ DLbNEFogsclay+zX/hTMPrGShXFKmq8b4wALpErBYFBFfctSfQqsfnK7YGLXtsvGpf6n Kx1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=+BD8bHPfSUIsdGULmpALqMFcshnOVLTSeycxgTymMVA=; b=bZDytr39Kna702/pW8mwgunS4pXwCXKrJzl0HofpTRtBui4yQ/12pKWVHO9WbaVtFk afsgeIqOMSiXZF7NvBPuOVsCBDE85W/t8G0yamycNGjNqv5PnHJGJTRwE3TO4ITfNngX 25+RssfDM72pVEEyrMqfYMrrlguWhV+rTiqwrghAF3Ymv2Vzh1Fdmd0Ge8xKD3Ae8EO3 oaRoxMuin4FiZ2VmVXqLWBQGHjekW4TQnjtRDJhKbo1CPUl58u8Q9RDrkN21yWfU56DJ DlPKbkoYyTEmPlFilWTRwW/w0OOX3rKUYwIl6ivs1MVbwEpziAMiK5KyaCmGsK5ibQnY xC2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=I4xa0mmX; 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 y16si21240074ejq.386.2021.08.10.20.14.54; Tue, 10 Aug 2021 20:15:18 -0700 (PDT) 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=@infradead.org header.s=casper.20170209 header.b=I4xa0mmX; 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 S232994AbhHKDNX (ORCPT + 99 others); Tue, 10 Aug 2021 23:13:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232683AbhHKDNW (ORCPT ); Tue, 10 Aug 2021 23:13:22 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8F6DC061765; Tue, 10 Aug 2021 20:12:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=+BD8bHPfSUIsdGULmpALqMFcshnOVLTSeycxgTymMVA=; b=I4xa0mmXWHwafl3+3KlzjMpsyd fUDC2rCzytydPvZwxv4eg1zjcIT9R1A8+A4HqPQ6mCODHFMqrO5Kp8ZPaAP+ny13bHGHoMgUownQV FCQ7o9P4oaCoPavC67lamAt3OnQkvedFXaLOBM89v5OJGYdsXLCEvAbWxoXakJwK6aUXlnurKFXmp qi3UHdok32ZAGR3xFE/OIZgcIm8l8Ljb/KD3cEe6/oPgki6UQNwoSVJ/VUy3AUktlr22h6CSu2/CD 4Q1Bz5hDtuBvdDL0LMnshp6wDgSyRpceeTz6kSmWn//V9ymip8+PONYeZpBihfUzvpbQl2y/RmYOp WtK6fHrA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDefG-00CtuP-Hv; Wed, 11 Aug 2021 03:12:33 +0000 Date: Wed, 11 Aug 2021 04:12:22 +0100 From: Matthew Wilcox To: David Howells Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v14 061/138] mm/migrate: Add folio_migrate_flags() Message-ID: References: <20210715033704.692967-62-willy@infradead.org> <20210715033704.692967-1-willy@infradead.org> <1812509.1628629765@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1812509.1628629765@warthog.procyon.org.uk> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 10, 2021 at 10:09:25PM +0100, David Howells wrote: > Matthew Wilcox (Oracle) wrote: > > > + if (folio_test_error(folio)) > > + folio_set_error(newfolio); > > + if (folio_test_referenced(folio)) > > + folio_set_referenced(newfolio); > > + if (folio_test_uptodate(folio)) > > + folio_mark_uptodate(newfolio); > > + if (folio_test_clear_active(folio)) { > > + VM_BUG_ON_FOLIO(folio_test_unevictable(folio), folio); > > + folio_set_active(newfolio); > > + } else if (folio_test_clear_unevictable(folio)) > > + folio_set_unevictable(newfolio); > > + if (folio_test_workingset(folio)) > > + folio_set_workingset(newfolio); > > + if (folio_test_checked(folio)) > > + folio_set_checked(newfolio); > > + if (folio_test_mappedtodisk(folio)) > > + folio_set_mappedtodisk(newfolio); > > Since a bunch of these are bits in folio->flags and newfolio->flags, I wonder > if it's better to do use a cmpxchg() loop or LL/SC construct to transfer all > the relevant flags in one go. I have plans for that, but they're on hold until the folio work is a bit further progressed. It also helps code that does something like: if (folio_test_dirty(folio) || folio_test_writeback(folio))