From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A6C2C35246 for ; Wed, 29 Jan 2020 22:00:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A7ED4206D5 for ; Wed, 29 Jan 2020 22:00:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A7ED4206D5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 28CC46B02A3; Wed, 29 Jan 2020 17:00:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 23CC46B02A4; Wed, 29 Jan 2020 17:00:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1540A6B02A5; Wed, 29 Jan 2020 17:00:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0034.hostedemail.com [216.40.44.34]) by kanga.kvack.org (Postfix) with ESMTP id F06036B02A3 for ; Wed, 29 Jan 2020 17:00:31 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 8A3A78248047 for ; Wed, 29 Jan 2020 22:00:31 +0000 (UTC) X-FDA: 76432041462.18.bed55_219aabcae041f X-HE-Tag: bed55_219aabcae041f X-Filterd-Recvd-Size: 4275 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Wed, 29 Jan 2020 22:00:30 +0000 (UTC) X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.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) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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