Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3934874pxj; Tue, 11 May 2021 15:34:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgilnGqDl2HdRLqFEsFTcuVvh6kIhTX0rGQ/9YUyCHWbUC3d2SexdXfUENgvCCkgsBPX+y X-Received: by 2002:a17:906:538a:: with SMTP id g10mr9059159ejo.243.1620772488603; Tue, 11 May 2021 15:34:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620772488; cv=none; d=google.com; s=arc-20160816; b=CNv/8xupJDfzIIt6omYENazGOGTqGOse5hXEO9yUe0Pw4r/KFxA1VPzSKtFSpXnK8+ X+/2y0E5DfUiXkGsi0CqyFrqAQl9wHrRV8QJahKs8F1sg+BRcgrmGOxnvAUen1RTlLy/ F2iFNJ+dQwfZmVXZSB2Q4gtmn2BjQxiYAwMX+Fa9GUqXUMiGV0sa5J3QRgPtYExfnbh4 erlcbcSLL1ktsWghitXLDNcvERR78LOojJIs5gVMTeRB1xdO2OPUxGGksnof7V62YaG/ KSZrV4lqY04qp7JMrHswTWrQQdXxsXpc2es68Ap40d8lppuSX06WL/0j6y1/EAmhtJPA WzgA== 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=x/Z5K3U5WC9FDDIUlCEk/fWAgWuXH3EOg7ra2fe+BOg=; b=RqEySPs7D7P8POXxosCR1zGM8LKBIsGPkW/44dI9JEriRpZ8vb5/ZGkGHVCkbJDs6A 6/GisrEA86Yg03nhsQLQN26Lxz2G4H7uYBalTb/iExxz2MLT0q2dSICnl/bXswa8Oa+L HkMSdkINY5EOE5gZj09rvtGbBWsMzm8PCY1mzMbgxYHfdra1Ou2A8KdestFQJbV5Hlah DeqTt2Y0isx7O/pSfNRiyUaeR3I5ZYAQh/4M49dMSeJaeyah9fMhJVHE+ow63CDRL7q3 xdXYRdZzlP2MMIaIPmDcLfJWsrBrDFmON/cH+1UZAf2t72DxW48kxjd56T1HKp9gmSc3 Q3sA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=mCUcAL5D; 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 hs9si17952661ejc.643.2021.05.11.15.34.18; Tue, 11 May 2021 15:34:48 -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=mCUcAL5D; 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 S229932AbhEKWeN (ORCPT + 99 others); Tue, 11 May 2021 18:34:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229714AbhEKWeN (ORCPT ); Tue, 11 May 2021 18:34:13 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C31EC061574 for ; Tue, 11 May 2021 15:33:06 -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=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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.