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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23C7BC433EF for ; Fri, 22 Apr 2022 11:48:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9DF386B0074; Fri, 22 Apr 2022 07:48:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 98E436B0075; Fri, 22 Apr 2022 07:48:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8562C6B0078; Fri, 22 Apr 2022 07:48:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 76CFC6B0074 for ; Fri, 22 Apr 2022 07:48:05 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 173F312128D for ; Fri, 22 Apr 2022 11:48:05 +0000 (UTC) X-FDA: 79384341330.13.F3FDC29 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf27.hostedemail.com (Postfix) with ESMTP id 8FC774002C for ; Fri, 22 Apr 2022 11:48:03 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 4D8EB1F388; Fri, 22 Apr 2022 11:48:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1650628083; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=NgFv0sENXvVUOYbTHjKFVYGjlYg+9hQjDCMXuvJ5JfM=; b=DwpVMrBR1w5g+T+TbhLjBoR3qPund5PzP/4AYuuLA6MgeeU5LvmArftpPqGysD33WsvxUS eMx5ACD1yTmnJq5WFlmqcQEUa6jjb8AXvjjlUzbU2xGmOyax5Dxest9GcvrDttW5KV5Rfc JsfqvZCHLNOSJBrnYTX3bJWJRGcftzs= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id E74642C145; Fri, 22 Apr 2022 11:48:01 +0000 (UTC) Date: Fri, 22 Apr 2022 13:48:00 +0200 From: Michal Hocko To: Miaohe Lin Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/mempolicy: clean up the code logic in queue_pages_pte_range Message-ID: References: <20220419122234.45083-1-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220419122234.45083-1-linmiaohe@huawei.com> X-Rspam-User: X-Rspamd-Queue-Id: 8FC774002C X-Stat-Signature: 7rw5kqbd66g1yfhwquraqcwsyxdo7n9a Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=DwpVMrBR; spf=pass (imf27.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com X-Rspamd-Server: rspam01 X-HE-Tag: 1650628083-470510 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 Tue 19-04-22 20:22:34, Miaohe Lin wrote: > Since commit e5947d23edd8 ("mm: mempolicy: don't have to split pmd for > huge zero page"), THP is never splited in queue_pages_pmd. Thus 2 is > never returned now. We can remove such unnecessary ret != 2 check and > clean up the relevant comment. Minor improvements in readability. > > Signed-off-by: Miaohe Lin Acked-by: Michal Hocko Thanks! > --- > mm/mempolicy.c | 12 +++--------- > 1 file changed, 3 insertions(+), 9 deletions(-) > > diff --git a/mm/mempolicy.c b/mm/mempolicy.c > index 75a8b247f631..3934476fb708 100644 > --- a/mm/mempolicy.c > +++ b/mm/mempolicy.c > @@ -441,12 +441,11 @@ static inline bool queue_pages_required(struct page *page, > } > > /* > - * queue_pages_pmd() has four possible return values: > + * queue_pages_pmd() has three possible return values: > * 0 - pages are placed on the right node or queued successfully, or > * special page is met, i.e. huge zero page. > * 1 - there is unmovable page, and MPOL_MF_MOVE* & MPOL_MF_STRICT were > * specified. > - * 2 - THP was split. > * -EIO - is migration entry or only MPOL_MF_STRICT was specified and an > * existing page was already on a node that does not follow the > * policy. > @@ -508,18 +507,13 @@ static int queue_pages_pte_range(pmd_t *pmd, unsigned long addr, > struct page *page; > struct queue_pages *qp = walk->private; > unsigned long flags = qp->flags; > - int ret; > bool has_unmovable = false; > pte_t *pte, *mapped_pte; > spinlock_t *ptl; > > ptl = pmd_trans_huge_lock(pmd, vma); > - if (ptl) { > - ret = queue_pages_pmd(pmd, ptl, addr, end, walk); > - if (ret != 2) > - return ret; > - } > - /* THP was split, fall through to pte walk */ > + if (ptl) > + return queue_pages_pmd(pmd, ptl, addr, end, walk); > > if (pmd_trans_unstable(pmd)) > return 0; > -- > 2.23.0 -- Michal Hocko SUSE Labs