Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1131273ybv; Thu, 13 Feb 2020 16:32:01 -0800 (PST) X-Google-Smtp-Source: APXvYqyrlmAFyrlD1Cgo8GyMa6DL4NQg91b3e2+WLzJSQydZQWQZU4LUL8HYK6w0Pzj7kttU+XCq X-Received: by 2002:a05:6830:140f:: with SMTP id v15mr167905otp.218.1581640321071; Thu, 13 Feb 2020 16:32:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581640321; cv=none; d=google.com; s=arc-20160816; b=BDaUqJRr314wqlbnAGfB+HoLAiMuS8fvFlDKTbWAYZ2/fJdeN35Qyb17l5nFuYxyge UqXPPbAH91UgMDJieqX/QSZ1bULB6zGvtOUkIUk57U+4a64Q9VNxVA24B9ZTU2ixvLDG qubsALs0cBKhFjqh1in8ycdGFtQIM0vYJ9Nn8+YAbeUUKz45Rh5CNx2fD1qb1oE9s3ae gWqDI4N5CobuZBJFnDZ67gj/01zpeuTptgXPRCYdhuybQsnPvhEwdd2LzdTMa+aZvzqd fO1BEi6T2/Pg50rweFyMyuMUcHoygmB6zGXLmEqRlRi8TSiQ9YiwGulVAsAGZf3k/kYY rzDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=8vz5BDtgAIEXGw3jN6yXS3a5J5lk3+KFXR5U8zD9eB0=; b=ZlYw8hMrO9DmQ1AXQOPlc40Lyo6tklmin9nLIPz30sXASrM//MQFQuMOEDutO0Kp1d ZE2km1x1F2yOapQGcCAMUEftJeYhN5JFA8Oqlt2/1A8aN/BbjTjm0vZCvq0RE7Rhswym PawKnTum2Fw2wBGyghMqYLUL8MvpYhTGLvxGis4p0voSP672FxRTu4dW3BsKZbC965ef IwxOW46wXeh0hVmZLNaCq4jNUbagj05gA3QgYorKlM2PQto5LPuMAbj1WA8MdhEtK/ow hX6bAd9eBaH9vRa9qjLHSVKMzlKE4iGjjWDB9OM5Cc0ebwUBZqQ1F77iQWOlwnjOP02G wk+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n186si1802003oig.191.2020.02.13.16.31.48; Thu, 13 Feb 2020 16:32:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728143AbgBNAaW (ORCPT + 99 others); Thu, 13 Feb 2020 19:30:22 -0500 Received: from mga09.intel.com ([134.134.136.24]:25633 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728089AbgBNAaU (ORCPT ); Thu, 13 Feb 2020 19:30:20 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Feb 2020 16:30:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,438,1574150400"; d="scan'208";a="227246075" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga007.fm.intel.com with ESMTP; 13 Feb 2020 16:30:18 -0800 From: Wei Yang To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, mhocko@suse.com, yang.shi@linux.alibaba.com, rientjes@google.com, david@redhat.com, Wei Yang Subject: [Patch v5 3/4] mm/migrate.c: check pagelist in move_pages_and_store_status() Date: Fri, 14 Feb 2020 08:30:16 +0800 Message-Id: <20200214003017.25558-4-richardw.yang@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200214003017.25558-1-richardw.yang@linux.intel.com> References: <20200214003017.25558-1-richardw.yang@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When pagelist is empty, it is not necessary to do the move and store. Also it consolidate the empty list check in one place. Signed-off-by: Wei Yang Acked-by: Michal Hocko Reviewed-by: David Hildenbrand --- mm/migrate.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index c9e18012d113..fe62b96852a3 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1499,9 +1499,6 @@ static int do_move_pages_to_node(struct mm_struct *mm, { int err; - if (list_empty(pagelist)) - return 0; - err = migrate_pages(pagelist, alloc_new_node_page, NULL, node, MIGRATE_SYNC, MR_SYSCALL); if (err) @@ -1589,6 +1586,9 @@ static int move_pages_and_store_status(struct mm_struct *mm, int node, { int err; + if (list_empty(pagelist)) + return 0; + err = do_move_pages_to_node(mm, pagelist, node); if (err) { /* @@ -1686,9 +1686,6 @@ static int do_pages_move(struct mm_struct *mm, nodemask_t task_nodes, current_node = NUMA_NO_NODE; } out_flush: - if (list_empty(&pagelist)) - return err; - /* Make sure we do not overwrite the existing error */ err1 = move_pages_and_store_status(mm, current_node, &pagelist, status, start, i, nr_pages); -- 2.17.1