Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp2269022rdb; Mon, 9 Oct 2023 20:38:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEpsGdjlwNP5iJaNwvD/OYo91VYuGZ1V8WLxhHd2SzxVUp5IT5wuPMZWQoOpI4ZRgUJMSA3 X-Received: by 2002:a17:902:ab82:b0:1c7:443d:7419 with SMTP id f2-20020a170902ab8200b001c7443d7419mr15252366plr.29.1696909139259; Mon, 09 Oct 2023 20:38:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696909139; cv=none; d=google.com; s=arc-20160816; b=K9pe7fM1nCuz0eIgMfbWc42KRJ6dDuHBNaz8q4gj9LC+4RdrBndP4HPBtgJF4wPy6M saekS/rbJts7zn6V9sUl2ox7IvqkTT0zKMITYKctocpiwzl6YrDB9lhgSxCcDxaD+AOA IIODYRogkFgaPdWdw8Su+ROL2ctSGyWE3+7k9MbmMw3lPNif+/jE4ONlmNz2AuC6lrgT sx1GmE8qrIvRvWENt5eDh8rCXPrJeAMf6JhKhL12lEcoXGZQK3QADd83axHkNF0aZ0Us 3p4EJNSaJ/fDcYeR1nCyeuEZ9dkQP04MgIaD7IxH/kDeT6tspT6/uuGapv9IA9/gKVGm /2Dg== 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=l03LmpsEEQtgEUMgpxJCj/4CDCV0rqj2PEX6zjNAXQs=; fh=2J663/jND28f9ia/ysABfOMjXeEjMwF13Si0RJUBh5s=; b=ZdpCZ5mPnTF1DHkR1HW2Tsdvu95AqdTwxBSEKSIqLRKrYPN2laHz91Z7zXKF/1TZ1J Z6xsIuLtx895wttBIUQ/uRajLoXIjmu7q7OLGfhFZCwsVveUDu6J8Gwq7EdWwbSnMufV hEZkToITJbuY7VdP0P8o0bQN7tnjqQGG0Pu+xHTNF94GUzkMqvK4kaKwLB46pvj9q6SY 2MwiQ/JWIZ2RULgtFKlLQuVMYWBG0C1moqLbXUYdZUH5ATagPv9eXuui3Lk50BO5CzJu vZvmvXRsWb23P1Wd4npCZLY9awY8hbcHZ9a3f+5/JMI5x4PnrmfbvhKce/oLDdspEZAz s3DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BH6Qg4Uj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id ki8-20020a170903068800b001c60d334996si10192262plb.622.2023.10.09.20.38.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 20:38:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BH6Qg4Uj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id AF46F8028577; Mon, 9 Oct 2023 20:38:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442053AbjJJDit (ORCPT + 99 others); Mon, 9 Oct 2023 23:38:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1441973AbjJJDis (ORCPT ); Mon, 9 Oct 2023 23:38:48 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B4C992 for ; Mon, 9 Oct 2023 20:38:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696909127; x=1728445127; h=from:to:cc:subject:references:date:in-reply-to: message-id:mime-version; bh=rBNxEXKO+pOeAvL44CpshEm8bQZYocM51QCHssvFplE=; b=BH6Qg4UjAxzHvbx+K8/rlGtBjNfJS6Mvvtc/mUyeXpQO7vaPjeYqpY6I nqsgdAhCM/tvo2xbiClDoI1Fr+5ShUBj6nIt7sVljnBoahi15xhSEFHQl mEIJ6UACsY/51kM0TsxgJxFy80H6Kizec5kldTzl3RRvaqEG2OxqZGNcK vD7nwrpWK83UbsFR22FanOslwj3UexBV3m3Tg4IxZqZeBSNo5fBAfTpoG 3IHEHSN15rmQlPOOPsdDVESgShDwxHdKQrpJaE4RwJF75ZHSFtQB4FPLz /rwNzpew8bD/rOGGErrKy+CR+jlOwzGZAjxfDXm5CXN/XZsnB9GiwBP3b Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10858"; a="450796925" X-IronPort-AV: E=Sophos;i="6.03,211,1694761200"; d="scan'208";a="450796925" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Oct 2023 20:38:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10858"; a="746921928" X-IronPort-AV: E=Sophos;i="6.03,211,1694761200"; d="scan'208";a="746921928" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.238.208.55]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Oct 2023 20:38:44 -0700 From: "Huang, Ying" To: Zi Yan Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Zi Yan , Andrew Morton , "Matthew Wilcox (Oracle)" , David Hildenbrand , Baolin Wang Subject: Re: [PATCH 1/1] mm/migrate: correct nr_failed in migrate_pages_sync() References: <20231009203231.1715845-1-zi.yan@sent.com> <20231009203231.1715845-2-zi.yan@sent.com> Date: Tue, 10 Oct 2023 11:36:34 +0800 In-Reply-To: <20231009203231.1715845-2-zi.yan@sent.com> (Zi Yan's message of "Mon, 9 Oct 2023 16:32:31 -0400") Message-ID: <87wmvvi1x9.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 09 Oct 2023 20:38:56 -0700 (PDT) X-Spam-Level: ** Zi Yan writes: > From: Zi Yan > > nr_failed was missing the rc value from migrate_pages_batch() and can > cause a mismatch between migrate_pages() return value and the number of > not migrated pages, i.e., when the return value of migrate_pages() is 0, > there are still pages left in the from page list. It will happen when a > non-PMD THP large folio fails to migrate due to -ENOMEM and is split > successfully but not all the split pages are not migrated, > migrate_pages_batch() would return non-zero, but astats.nr_thp_split = 0. > nr_failed would be 0 and returned to the caller of migrate_pages(), but > the not migrated pages are left in the from page list without being added > back to LRU lists. > > Fixes: 2ef7dbb26990 ("migrate_pages: try migrate in batch asynchronously firstly") > Signed-off-by: Zi Yan > --- > mm/migrate.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/migrate.c b/mm/migrate.c > index c602bf6dec97..5348827bd958 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -1834,7 +1834,7 @@ static int migrate_pages_sync(struct list_head *from, new_folio_t get_new_folio, > return rc; > } > stats->nr_thp_failed += astats.nr_thp_split; > - nr_failed += astats.nr_thp_split; > + nr_failed += rc + astats.nr_thp_split; > /* > * Fall back to migrate all failed folios one by one synchronously. All > * failed folios except split THPs will be retried, so their failure I don't think this is a correct fix. The failed folios will be retried in the following synchronous migration below. To fix the issue, we should track nr_split for all large folios (not only THP), then use nr_failed += astats.nr_split; -- Best Regards, Huang, Ying