Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp989281rwo; Wed, 2 Aug 2023 07:13:03 -0700 (PDT) X-Google-Smtp-Source: APBJJlHcYfvJC8QFJ/ndBjqluspmREMFnt1kQCn+X4VUWd5QNNHwP7EVNWYYif7HPgltwBEUyVWf X-Received: by 2002:a05:6e02:12af:b0:349:2d61:8631 with SMTP id f15-20020a056e0212af00b003492d618631mr5854480ilr.10.1690985582763; Wed, 02 Aug 2023 07:13:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690985582; cv=none; d=google.com; s=arc-20160816; b=GI1Cgy9nxDnNqkSbNFOoiZT9F+7jAlmOvPogTdptawW096EiQJcSaMWI1kD3QI2Vc0 8ZNbzA0VoI4Djrf0UV8AQxb1WX9b0bd8Ivra7BeUnG6fq5SeFP36XXfQ/lAtTQL9qddw 12P5TXwl6M7CIVHZHsM/qu4CVsSl4k+pCV5L3ArYHeWEazUFIwiv0wDX+pQf3jRwWkoe kVu2EnOlI/M0Sy7pKxcXqc1Uz33RBTsPUZfDWxW9tlmxagKFumiMLWrNafjEaePJzG42 NXd+kQPV6Ln9yrwsnywBzQd6BFjWSTvEltk58GGPrLLVRY6wbHDoUAEx1AzoeAzpxW0M 4+Kw== 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=w9tr1AR4GmU5vaVxpOCOeNBoe0QTS0eYPR8meuRf/nA=; fh=qi7wCCwZxhgDF5fmSP0lvzQvCIoh4z/2RwOeLycP6nI=; b=au9Fi1Vi0kxfRwC1xjRqU5jQ+yImeGMQNx9ij2uMLVvAOeURZMpXXdZL/lUMd1hHBM Y8Kr4U0Qkw9qOM4QdNQgIYqohqWn9y9ffIFope/eo4vmY6Z2jnCGLgcDTKHC2FxBHUbF 0yjbDlbLdu4f6xoQnAWPf7CJ2stA4TDWZDy28C9GRX/L6DZYZ08pOWESeMm57h2SYD0w 28YifHba2vECIT5fRNJZG7jQZfijrsioDEPW2mTT3WPULqUswPoDwaT8Y2ZUGyhyI+l2 TRsTuX31U21HjBn0GGlLKr4AR1p1ZK908vYCp2iNKe8gTahUlYy9B1xUUILxgHLm2BlH eqrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Sty7cJ5I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bs1-20020a632801000000b0055c96379d01si1826258pgb.705.2023.08.02.07.12.50; Wed, 02 Aug 2023 07:13:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Sty7cJ5I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234041AbjHBMbD (ORCPT + 99 others); Wed, 2 Aug 2023 08:31:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232050AbjHBMbC (ORCPT ); Wed, 2 Aug 2023 08:31:02 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A95C99B for ; Wed, 2 Aug 2023 05:31:00 -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=w9tr1AR4GmU5vaVxpOCOeNBoe0QTS0eYPR8meuRf/nA=; b=Sty7cJ5I21M8pIW4vcPtXwcLTD wQ/lq/rUczznk1i6mZJJW+DHIjI6Nyhnqe68OyZW+pH5fn0qrkduW0/m0uhcG9/cdRBqXTuKHVLKy 1aD2p+pBmBIy1NAPTwVRde13kciPSuh/DsMZfA8QbLf8YjYISmJQSUIYCvDCKEy52IpVfcHIZijfq yJSIJpJT4Q3ZskApOYQl1lEpvgkIzLXAVII58nPMrPyPWM1UN2P05Qibg3X+6DCr/Ajb0rnnBW8C4 LdaQE+uI5nTuVIgXZmZQjVUbYNX1LKxIfkz6oy3BvR56JmkP+kD5ol4M1uEDYVaEtRfiTN7kI8+/m I+1zVq3Q==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qRB09-00EvsP-Rf; Wed, 02 Aug 2023 12:30:53 +0000 Date: Wed, 2 Aug 2023 13:30:53 +0100 From: Matthew Wilcox To: Kefeng Wang Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Huang Ying , David Hildenbrand Subject: Re: [PATCH 2/4] mm: migrate: convert numamigrate_isolate_page() to numamigrate_isolate_folio() Message-ID: References: <20230802095346.87449-1-wangkefeng.wang@huawei.com> <20230802095346.87449-3-wangkefeng.wang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230802095346.87449-3-wangkefeng.wang@huawei.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 02, 2023 at 05:53:44PM +0800, Kefeng Wang wrote: > -static int numamigrate_isolate_page(pg_data_t *pgdat, struct page *page) > +static int numamigrate_isolate_folio(pg_data_t *pgdat, struct folio *folio) > { > - int nr_pages = thp_nr_pages(page); > - int order = compound_order(page); > + int nr_pages = folio_nr_pages(folio); > + int order = folio_order(folio); > > - VM_BUG_ON_PAGE(order && !PageTransHuge(page), page); > + VM_BUG_ON_FOLIO(order && !folio_test_pmd_mappable(folio), folio); I don't know why we have this assertion. I would be inclined to delete it as part of generalising the migration code to handle arbitrary sizes of folio, rather than assert that we only support PMD size folios. > /* Do not migrate THP mapped by multiple processes */ > - if (PageTransHuge(page) && total_mapcount(page) > 1) > + if (folio_test_pmd_mappable(folio) && folio_estimated_sharers(folio) > 1) > return 0; I don't know if this is the right logic. We've willing to move folios mapped by multiple processes, as long as they're smaller than PMD size, but once they get to PMD size they're magical and can't be moved?