Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1015229ybl; Tue, 28 Jan 2020 16:55:33 -0800 (PST) X-Google-Smtp-Source: APXvYqxPWFg6j+gNCyiip/Qwp8KQKr1I+NxysuFX1Ed2LIvJTH7FjC/p/0tly2L8B4z7XJk8xWEz X-Received: by 2002:a05:6830:1184:: with SMTP id u4mr13339472otq.221.1580259332928; Tue, 28 Jan 2020 16:55:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580259332; cv=none; d=google.com; s=arc-20160816; b=jxY/jxegSFEgLPCoD1lp8cMuARUTrH5Cyc1zEf5mS4sAtszGl8bfw7dzHEI1cBdMSv jXHioCLSitMQOh2w6Z0w4FqIM56otQZV8Zx7tzrdSTebv8r0NbRqybaa3tUzNKs4K/1+ ILoF8HG/TPZyBKhQSWTe+7l8OqtRUm9u+WDQMebh7t1MWuw3MDb4z9g0PT+AiEOGgbaS T0lN2bs5MhtbRVVpJzmOTvXauvOIuayCzrLxltNGHgsSsvJVhbOo40HlXDskiAss2cuy q6WW61aoEuGrX5dalBVoeEBxq5adRp4/aFlyF0VTInLHkpTMhVT3i72FPcEL2CE9SnnX hT7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date; bh=UsxoiWc+CUexMO/2TnIcgwFU89JxxmrlqTbiUbScCA4=; b=GxAel1YRWsdlViKcgKeKWlb8TddqEuilGsjWOksy1Fol53VWZy2CvsXezdZ/+aPwVC qFTgqSIwnEEFTKJyXjXPpUTB7w3RGsqnQ/w/bB7QQX4hUehcBvttfItpVjmDyyml+Uzq y3JEBYz9Dd7azt6ejcQSYZhJjK2paoplKrgaSI9x2bKcUTxXJBEKh1cSntlmioaYwC6h AOBxKMgC/WQ0OEdmwSzba4aD9KutkC87zSjoxq9D9y1nncDe4whKV4Ntv+vr9U+Qs3iy SI4khh/P4u+Dxx9ZjC8ZkvknleyPHjPnyrpTsTCowewvivyk+PkJGO1YzdF3hYBhNDCq sn6A== 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 i20si263504oie.119.2020.01.28.16.55.18; Tue, 28 Jan 2020 16:55:32 -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 S1729463AbgA2AiC (ORCPT + 99 others); Tue, 28 Jan 2020 19:38:02 -0500 Received: from mga18.intel.com ([134.134.136.126]:40899 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729442AbgA2AiC (ORCPT ); Tue, 28 Jan 2020 19:38:02 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Jan 2020 16:38:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,375,1574150400"; d="scan'208";a="229458192" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by orsmga003.jf.intel.com with ESMTP; 28 Jan 2020 16:37:59 -0800 Date: Wed, 29 Jan 2020 08:38:12 +0800 From: Wei Yang To: David Hildenbrand Cc: Wei Yang , akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, mhocko@suse.com, yang.shi@linux.alibaba.com, rientjes@google.com Subject: Re: [Patch v2 2/4] mm/migrate.c: wrap do_move_pages_to_node() and store_status() Message-ID: <20200129003812.GC12835@richard> Reply-To: Wei Yang References: <20200122011647.13636-1-richardw.yang@linux.intel.com> <20200122011647.13636-3-richardw.yang@linux.intel.com> <15777c05-2f2c-b818-dacd-3ec31f83be8d@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <15777c05-2f2c-b818-dacd-3ec31f83be8d@redhat.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 28, 2020 at 11:14:55AM +0100, David Hildenbrand wrote: >On 22.01.20 02:16, Wei Yang wrote: >> Usually do_move_pages_to_node() and store_status() is a pair. There are >> three places call this pair of functions with almost the same form. > >I'd suggest > >" >Usually, do_move_pages_to_node() and store_status() are used in >combination. We have three similar call sites. > >Let's provide a wrapper for both function calls - >move_pages_and_store_status - to make the calling code easier to >maintain and fix (as noted by Yang Shi, the return value handling of >do_move_pages_to_node() has a flaw). >" Looks good. > >> >> This patch just wrap it to make it friendly to audience and also >> consolidate the move and store action into one place. Also mentioned by >> Yang Shi, the handling of do_move_pages_to_node()'s return value is not >> proper. Now we can fix it in one place. >> >> Signed-off-by: Wei Yang >> Acked-by: Michal Hocko >> --- >> mm/migrate.c | 30 +++++++++++++++++++----------- >> 1 file changed, 19 insertions(+), 11 deletions(-) >> >> diff --git a/mm/migrate.c b/mm/migrate.c >> index 4c2a21856717..a4d3bd6475e1 100644 >> --- a/mm/migrate.c >> +++ b/mm/migrate.c >> @@ -1583,6 +1583,19 @@ static int add_page_for_migration(struct mm_struct *mm, unsigned long addr, >> return err; >> } >> >> +static int move_pages_and_store_status(struct mm_struct *mm, int node, >> + struct list_head *pagelist, int __user *status, >> + int start, int nr) > >nit: indentation > You mean indent like this? static int move_pages_and_store_status(struct mm_struct *mm, int node, struct list_head *pagelist, int __user *status, This would be along list and I am afraid this is not the only valid code style? >> +{ >> + int err; >> + >> + err = do_move_pages_to_node(mm, pagelist, node); >> + if (err) >> + return err; >> + err = store_status(status, start, node, nr); >> + return err; > >return store_status(status, start, node, nr); > >directly > ok > > >Apart from that (and some more indentation nits) > >Reviewed-by: David Hildenbrand > > >-- >Thanks, > >David / dhildenb -- Wei Yang Help you, Help me