Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1029675ybl; Wed, 29 Jan 2020 14:02:05 -0800 (PST) X-Google-Smtp-Source: APXvYqzqMtfmpAjasosnS+kNXY8UXCPwfvgZx4D4T56rhHsxNkanmP27pgJwLTyPXj628wLxR2yd X-Received: by 2002:aca:2109:: with SMTP id 9mr720408oiz.119.1580335325281; Wed, 29 Jan 2020 14:02:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580335325; cv=none; d=google.com; s=arc-20160816; b=wbKDQMH3uzFYOFn5SwML0kFCOqnVz95wE/wTFTIpIe5zHYIE4yir036XKrERdF1Vmd Mv86g8u1YWpiY4N0sY8QCoRhYfEQob/tEnM38pp/524X3RmtsmCq9KZKgH/wBJhOiuwi T6Or3povA1WMZwyebBi56rcqUdMy6uASoicQlU5WwZEu5Mb1KtNJ22NJCLCM411l5+gy KAQ4dVtVIHoP2EWBnUvCUJjTYRRKuXAR3VNsXOSAeXUhRrEQ1z81mq5viTqum5xbEmgv fBxjC9RWgrkmn71VGr4606lCI7rfvcUWwZ3RrjxIWFIh4WrAfRE2S+7b9HqPaHN+Cw5f BaxA== 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=PtakgLGxTJflo78ClOE00o1VAG/00OB3rsFJSOFyM1w=; b=r8Vg5KtO58cJnFckG9au8qF4cz4QD3opdhz9vmMslK0HUh2Hw0Viy0r6QBHFtqNzHv JfxVwnlFobkDAZrsAkqGG9Ob5myw1eKUF6HSTs8MpLQ3wDAnnRNjyRKGZ0qm5Aml/daI Cs+zbnSMZkY8MqXHpnb/7yCdkMWzPqB4O+Msmqlx3pU+J/KlQ6rBz39vToIBtyIYnpso lB60IZjOGCXyB2pgmSMpLJb1ZOBgWdSMK5n5mUJvca5itbgJyhWWSSxwLnvf2UWdPVmV cAUVGAzb9w9/qmTUoUAa0cAXnIiTmHLYsp5Gx635sHl+DH0hPPDSEvWeGrM/RNY17g0d /QHw== 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 m14si1797622otr.131.2020.01.29.14.01.53; Wed, 29 Jan 2020 14:02:05 -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 S1726692AbgA2WAa (ORCPT + 99 others); Wed, 29 Jan 2020 17:00:30 -0500 Received: from mga11.intel.com ([192.55.52.93]:54061 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726222AbgA2WAa (ORCPT ); Wed, 29 Jan 2020 17:00:30 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Jan 2020 14:00:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,379,1574150400"; d="scan'208";a="218080404" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by orsmga007.jf.intel.com with ESMTP; 29 Jan 2020 14:00:27 -0800 Date: Thu, 30 Jan 2020 06:00:40 +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: <20200129220040.GB20736@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> <20200129003812.GC12835@richard> <68d4f7fb-2f37-2b11-dd0f-2e059415daf2@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <68d4f7fb-2f37-2b11-dd0f-2e059415daf2@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 Wed, Jan 29, 2020 at 10:28:53AM +0100, David Hildenbrand wrote: >On 29.01.20 01:38, Wei Yang wrote: >> 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? > >Yes, that's what I meant. Documentation/process/coding-style.rst doesn't >mention any specific way, but this is the most commonly used one. > >Indentation in this file mostly sticks to something like this as well, >but yeah, it's often a mess and not consistent. > >That's why I note it whenever I see it, to make it eventually more >consistent (and only make it a nit) :) > You are right. I would leave as it now, if someone else still have the same suggestion to fix it. Thanks :-) >-- >Thanks, > >David / dhildenb -- Wei Yang Help you, Help me