Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp12548240rwl; Tue, 3 Jan 2023 16:35:53 -0800 (PST) X-Google-Smtp-Source: AMrXdXurNYv0eYkU9/AcN2iRPhxAxBzNpBcceeoo6O1dfkw5BREci0EvJ8sjctyufQfK0J8Qcdt1 X-Received: by 2002:a17:902:bb86:b0:192:8d16:bf57 with SMTP id m6-20020a170902bb8600b001928d16bf57mr24320170pls.53.1672792552986; Tue, 03 Jan 2023 16:35:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672792552; cv=none; d=google.com; s=arc-20160816; b=JVv/QdKu+BAfixQ/pNQddMxfESVF1JXNjETVl0r4IJZUe0jBAKndGgyuGBdm/Y5rJf wgxMNi+ESgXr4PCtGnWs8U1Ofrso9kQqvCkBpEps+JCwOQU/B8OIdjcyYHswfogxyDbT GiUoBalDDVBA7cP8k1rd3py7uc7DzZCIPCl/Z0yL1VxT1J5BeEgwMQlSUi+ypfBIcepk tPhlFA0/dH6ye3BoQBZd9lltxXqPHg12fDtTTCasIXIi3195VcnOEO5BaPBUZ+B8zJ16 UEoNQJ4xyl9GKBEj+5rrKMdhyxD/nUhqQCg7mWiS8hLW3OwLUz9Tt0IPeqF1W2EXlwr8 Jkag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dkim-signature; bh=kjM0/qZnYLDeEg5eQK294rCN/jkR7mDtn6s8ArJtdoA=; b=xr3pVjsd7qXzSMUnnTJMVjhsH78EjzEZn4WHS/Wtki0HmjcuPRsgmHT61LCGZMcMIJ HFlEcybc52y+BHFKl7SEklrLU8tzMQeLGf7fNgMaX8DoFDYa2w7S6qD+0qF88PrIasCH IZBdCMCD2iF2cQdI82zpdxaP4KcxadRHirhDmoUJJDMCCFtTyyGsRzWjcI3QFsccz3h3 6LBo57HuhQcBlSHLe6mepbN/I7oV4igbn/ImppZKIusNxyiQZF1GyO6AS4SG4EwBe2Yr NMlU7IZV0QTFuJQnzi/B7Y1gd8l0DUZGNMWbU1so5/gU3/vK0lV9a66AlqAcyi6bimVL FVow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dGOuXdYP; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t9-20020a170902e84900b00188e5c9e026si35352878plg.102.2023.01.03.16.35.45; Tue, 03 Jan 2023 16:35:52 -0800 (PST) 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=@intel.com header.s=Intel header.b=dGOuXdYP; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238499AbjADA0T (ORCPT + 57 others); Tue, 3 Jan 2023 19:26:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238722AbjADAZy (ORCPT ); Tue, 3 Jan 2023 19:25:54 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9756817592 for ; Tue, 3 Jan 2023 16:25:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672791940; x=1704327940; h=from:to:cc:subject:references:date:in-reply-to: message-id:mime-version; bh=edKy2ReilvbH/TaDlMaXGjVC5v8DHE8hu3zYyHeDKrM=; b=dGOuXdYP4I+59Zb0otzZV52T4wy3MY4jCHkW2QMHwD3VmiGundwrEtgI 6/ac+6vwfJY7mvRyUJTG+7qzPOR085LNCEt1LZ+iPw9bVIBwf0skkCAFj eYkpgqEHLyE7ToArE1ZKrmQd8vQSj5ag4vBIkqGW4Dj2j3Yb1KDlUJYfm 8e4+uMMob9qbqzPDoN0MLCLx+uG1MClTRXBbR2OMbGygDCQ1I6uxwFI6S /yL3ORnnUae36tL52TdmgsFIPGzM2HXw3tn4Y03H5diIqmWxpTWe0lUOO sSAsp5rj+dY8wXvqCD1llHfY+2ThM56FSb/Ou6Mr2sRfeQgdwS8QoVjcC Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10579"; a="319501208" X-IronPort-AV: E=Sophos;i="5.96,297,1665471600"; d="scan'208";a="319501208" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jan 2023 16:25:25 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10579"; a="605011640" X-IronPort-AV: E=Sophos;i="5.96,297,1665471600"; d="scan'208";a="605011640" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.238.208.55]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jan 2023 16:25:21 -0800 From: "Huang, Ying" To: Zi Yan Cc: Andrew Morton , , , Yang Shi , Baolin Wang , Oscar Salvador , "Matthew Wilcox" , Bharata B Rao , "Alistair Popple" , haoxin Subject: Re: [PATCH 3/8] migrate_pages: restrict number of pages to migrate in batch References: <20221227002859.27740-1-ying.huang@intel.com> <20221227002859.27740-4-ying.huang@intel.com> <761F148B-555B-4C51-8A1E-F17ABA85D014@nvidia.com> Date: Wed, 04 Jan 2023 08:24:12 +0800 In-Reply-To: <761F148B-555B-4C51-8A1E-F17ABA85D014@nvidia.com> (Zi Yan's message of "Tue, 03 Jan 2023 13:40:00 -0500") Message-ID: <87pmbvno43.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE 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 Zi Yan writes: > On 26 Dec 2022, at 19:28, Huang Ying wrote: [snip] >> +/* >> + * migrate_pages - migrate the folios specified in a list, to the free folios >> + * supplied as the target for the page migration >> + * >> + * @from: The list of folios to be migrated. >> + * @get_new_page: The function used to allocate free folios to be used >> + * as the target of the folio migration. >> + * @put_new_page: The function used to free target folios if migration >> + * fails, or NULL if no special handling is necessary. >> + * @private: Private data to be passed on to get_new_page() >> + * @mode: The migration mode that specifies the constraints for >> + * folio migration, if any. >> + * @reason: The reason for folio migration. >> + * @ret_succeeded: Set to the number of folios migrated successfully if >> + * the caller passes a non-NULL pointer. >> + * >> + * The function returns after 10 attempts or if no folios are movable any more >> + * because the list has become empty or no retryable folios exist any more. >> + * It is caller's responsibility to call putback_movable_pages() to return folios >> + * to the LRU or free list only if ret != 0. >> + * >> + * Returns the number of {normal folio, large folio, hugetlb} that were not >> + * migrated, or an error code. The number of large folio splits will be >> + * considered as the number of non-migrated large folio, no matter how many >> + * split folios of the large folio are migrated successfully. >> + */ >> +int migrate_pages(struct list_head *from, new_page_t get_new_page, >> + free_page_t put_new_page, unsigned long private, >> + enum migrate_mode mode, int reason, unsigned int *ret_succeeded) >> +{ >> + int rc, rc_gether; > > rc_gether -> rc_gather? Good catch! Thanks! Will change this in the next version. Best Regards, Huang, Ying >> + int nr_pages; >> + struct folio *folio, *folio2; >> + LIST_HEAD(folios); >> + LIST_HEAD(ret_folios); >> + struct migrate_pages_stats stats; >> + [snip]