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.5 required=3.0 tests=INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 E1574C33CA1 for ; Mon, 20 Jan 2020 10:01:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id ACDA320684 for ; Mon, 20 Jan 2020 10:01:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ACDA320684 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5B4606B061E; Mon, 20 Jan 2020 05:01:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 564E46B061F; Mon, 20 Jan 2020 05:01:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 47A6A6B0620; Mon, 20 Jan 2020 05:01:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0203.hostedemail.com [216.40.44.203]) by kanga.kvack.org (Postfix) with ESMTP id 30F886B061E for ; Mon, 20 Jan 2020 05:01:12 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id E08DFA776 for ; Mon, 20 Jan 2020 10:01:11 +0000 (UTC) X-FDA: 76397569542.22.tub31_449b85a9bad54 X-HE-Tag: tub31_449b85a9bad54 X-Filterd-Recvd-Size: 4661 Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by imf35.hostedemail.com (Postfix) with ESMTP for ; Mon, 20 Jan 2020 10:01:11 +0000 (UTC) Received: by mail-wm1-f67.google.com with SMTP id d73so13792336wmd.1 for ; Mon, 20 Jan 2020 02:01:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=jxk5yp1oVvwf0kXhOVENyg67VI0xjVmnjfrfkil0lfs=; b=IsrL0n8hq9tZg6qK5Rv5sDXk1ejD5+6Rod52IvepLcbLz4xG6rs+gALn0hJMmrnV6B FrW37dqnOiHm6azjxr8U8cOSVuuCPxJ9XtADBKomF4SsuCkV8yd+srjStODM64hVz6BO 13xfUIfX0GBwbWaac9jWKcmfDaEyIJ2b7yoW4aVPM4N3HeKx8Hr7k/OYVCVk7ZW0MyFU WEGT1EuL0XqYCHoKYc11EJze1DPoE4vkzCmiFl40p2vazfMQEinwAvwF6XaYJV+5JMy0 tOpwo7BN6Kq4OaDdkh/Ldt0m8i5RidCInFgL9Ty0ixdZXZpCDWlPFlIt+HFZe7kA7G73 pKsA== X-Gm-Message-State: APjAAAWdk8hR3RLJFjaiS/PxdGZC/ZCTe0XMSI2Qn+Y2+FAaT//mpYnL vW7fRHFsKJuhEDsfaAf23vI= X-Google-Smtp-Source: APXvYqxYBuIQmfBusK7EhcIIuQra7HOCCwsHpk+12XqToXyw5GLSis2BrXeymZqh4TW0/qsUevxd+Q== X-Received: by 2002:a05:600c:2503:: with SMTP id d3mr17772687wma.84.1579514470363; Mon, 20 Jan 2020 02:01:10 -0800 (PST) Received: from localhost (prg-ext-pat.suse.com. [213.151.95.130]) by smtp.gmail.com with ESMTPSA id z21sm22219218wml.5.2020.01.20.02.01.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jan 2020 02:01:09 -0800 (PST) Date: Mon, 20 Jan 2020 11:01:08 +0100 From: Michal Hocko To: Wei Yang Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, yang.shi@linux.alibaba.com Subject: Re: [PATCH 6/8] mm/migrate.c: handle same node and add failure in the same way Message-ID: <20200120100108.GQ18451@dhcp22.suse.cz> References: <20200119030636.11899-1-richardw.yang@linux.intel.com> <20200119030636.11899-7-richardw.yang@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200119030636.11899-7-richardw.yang@linux.intel.com> User-Agent: Mutt/1.12.2 (2019-09-21) 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 Sun 19-01-20 11:06:34, Wei Yang wrote: > When page is not queued for migration, there are two possible cases: > > * page already on the target node > * failed to add to migration queue > > Current code handle them differently, this leads to a behavior > inconsistency. > > Usually for each page's status, we just do store for once. While for the > page already on the target node, we might store the node information for > twice: > > * once when we found the page is on the target node > * second when moving the pages to target node successfully after above > action > > The reason is even we don't add the page to pagelist, but store_status() > does store in a range which still contains the page. > > This patch handles these two cases in the same way to reduce this > inconsistency and also make the code a little easier to read. Yeah, the improvement is really marginal. I do not feel strongly one way or another. > Signed-off-by: Wei Yang Acked-by: Michal Hocko > --- > mm/migrate.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/mm/migrate.c b/mm/migrate.c > index 46a5697b7fc6..aee5aeb082c4 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -1657,18 +1657,18 @@ static int do_pages_move(struct mm_struct *mm, nodemask_t task_nodes, > err = add_page_for_migration(mm, addr, current_node, > &pagelist, flags & MPOL_MF_MOVE_ALL); > > - if (!err) { > - /* The page is already on the target node */ > - err = store_status(status, i, current_node, 1); > - if (err) > - goto out_flush; > - continue; > - } else if (err > 0) { > + if (err > 0) { > /* The page is successfully queued for migration */ > continue; > } > > - err = store_status(status, i, err, 1); > + /* > + * Two possible cases for err here: > + * == 0: page is already on the target node, then store > + * current_node to status > + * < 0: failed to add page to list, then store err to status > + */ > + err = store_status(status, i, err ? : current_node, 1); > if (err) > goto out_flush; > > -- > 2.17.1 > -- Michal Hocko SUSE Labs