linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Wang Qing <wangqing@vivo.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: delete bool "migrated"
Date: Tue, 2 Mar 2021 15:55:34 -0800	[thread overview]
Message-ID: <20210302155534.34fa737060e1f29ebfe2fe52@linux-foundation.org> (raw)
In-Reply-To: <1614603421-2681-1-git-send-email-wangqing@vivo.com>

On Mon,  1 Mar 2021 20:57:01 +0800 Wang Qing <wangqing@vivo.com> wrote:

> Smatch gives the warning:
> 	do_numa_page() warn: assigning (-11) to unsigned variable 'migrated'
> 
> ...
>
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -4102,7 +4102,6 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
>  	int page_nid = NUMA_NO_NODE;
>  	int last_cpupid;
>  	int target_nid;
> -	bool migrated = false;
>  	pte_t pte, old_pte;
>  	bool was_writable = pte_savedwrite(vmf->orig_pte);
>  	int flags = 0;
> @@ -4172,8 +4171,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
>  	}
>  
>  	/* Migrate to the requested node */
> -	migrated = migrate_misplaced_page(page, vma, target_nid);
> -	if (migrated) {
> +	if (migrate_misplaced_page(page, vma, target_nid)) {
>  		page_nid = target_nid;
>  		flags |= TNF_MIGRATED;
>  	} else

Looks right.

Methinks both migrate_misplaced_page() and numamigrate_isolate_page()
should return bools.  (And that their return values should be documented!)











      reply	other threads:[~2021-03-02 23:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-01 12:57 [PATCH] mm: delete bool "migrated" Wang Qing
2021-03-02 23:55 ` Andrew Morton [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210302155534.34fa737060e1f29ebfe2fe52@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=wangqing@vivo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).