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.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 67AB0C433ED for ; Tue, 11 May 2021 22:33:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 93F7F6191C for ; Tue, 11 May 2021 22:33:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 93F7F6191C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1E2DF6B006E; Tue, 11 May 2021 18:33:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 193066B0070; Tue, 11 May 2021 18:33:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 033876B0072; Tue, 11 May 2021 18:33:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0248.hostedemail.com [216.40.44.248]) by kanga.kvack.org (Postfix) with ESMTP id DAF226B006E for ; Tue, 11 May 2021 18:33:01 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 9CC51B9EF for ; Tue, 11 May 2021 22:33:01 +0000 (UTC) X-FDA: 78130401762.20.8891828 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf02.hostedemail.com (Postfix) with ESMTP id 7985540002D6 for ; Tue, 11 May 2021 22:32:27 +0000 (UTC) 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=x/Z5K3U5WC9FDDIUlCEk/fWAgWuXH3EOg7ra2fe+BOg=; b=mCUcAL5DLLPoSN5JB4sIsU7mVg 5bJu0gCKjYPDPr14t8Bg/dzbOxWAuc33h8bxFs4N5dW7VK2NFgUG5ASotRI9Rd8hU2LdZwbIjR1Io 75Mf3kj5p1M6NxlyOn3Dp8dpaw7lRhMTvFRHNDTg4/ThrUuwpbmllJ1AE2baNVupXhPMi7rJ5tmpl +7qpYIDgzLiYgh31HSEPPvFpj90wkbxDZ8ChYNEPJhjKXi7lyjTvlYTRzDjAyd9ATKLkI8sVTlSJ4 kB1JpnzErLwpO3zzvwZjE0ZsE+7RTHd6BwpO5C9kt0G++aiyOMxQr4G5TccCEoMAzrWN4OiAnXWLC ircPteBQ==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lgavi-007jiU-Lu; Tue, 11 May 2021 22:32:45 +0000 Date: Tue, 11 May 2021 23:32:42 +0100 From: Matthew Wilcox To: Zi Yan Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 1/3] mm/migrate: Add folio_migrate_mapping Message-ID: References: <20210510232308.1592750-1-willy@infradead.org> <20210510232308.1592750-2-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=mCUcAL5D; dmarc=none; spf=none (imf02.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Stat-Signature: pk8imbuyqpujijgf6j7uaz6yqs638ixk X-Rspamd-Queue-Id: 7985540002D6 X-Rspamd-Server: rspam02 Received-SPF: none (infradead.org>: No applicable sender policy available) receiver=imf02; identity=mailfrom; envelope-from=""; helo=casper.infradead.org; client-ip=90.155.50.34 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1620772347-241009 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 Tue, May 11, 2021 at 06:04:21PM -0400, Zi Yan wrote: > On 10 May 2021, at 19:23, Matthew Wilcox (Oracle) wrote: > > +++ b/mm/migrate.c > > @@ -355,7 +355,7 @@ static int expected_page_refs(struct address_space *mapping, struct page *page) > > */ > > expected_count += is_device_private_page(page); > > if (mapping) > > - expected_count += thp_nr_pages(page) + page_has_private(page); > > + expected_count += compound_nr(page) + page_has_private(page); > > Why this change? Is it because you are passing folio->page to expected_page_refs() below > and the nr_pages for the folio should be checked with folio_nr_pages() which just returns > compound_nr()? > > The change seems to imply that folio can be compound page and migrated even when THP is > disabled. Is it the case or something else? That's exactly right. In general, I don't like to pass &folio->page to functions, but this one might be handling device private pages (apparently), and they have bogus refcounts, so devmap pages are explicitly disallowed from being folios until the refcount problem gets fixed.