linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] mm/huge_memory.c: remove unused variable 'count'
@ 2021-05-14  6:59 Pu Lehui
  2021-05-14 18:48 ` Yang Shi
  0 siblings, 1 reply; 2+ messages in thread
From: Pu Lehui @ 2021-05-14  6:59 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, linux-kernel, pulehui

mm/huge_memory.c:2663:6: warning:
 variable ‘count’ set but not used [-Wunused-but-set-variable]
  2663 |  int count, mapcount, extra_pins, ret;
       |      ^~~~~

This variable is not used in function , this commit
remove it to fix the warning.

Signed-off-by: Pu Lehui <pulehui@huawei.com>
---
 mm/huge_memory.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 52ca04b905cf..a23a127302e9 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -2660,7 +2660,7 @@ int split_huge_page_to_list(struct page *page, struct list_head *list)
 	struct deferred_split *ds_queue = get_deferred_split_queue(head);
 	struct anon_vma *anon_vma = NULL;
 	struct address_space *mapping = NULL;
-	int count, mapcount, extra_pins, ret;
+	int mapcount, extra_pins, ret;
 	pgoff_t end;
 
 	VM_BUG_ON_PAGE(is_huge_zero_page(head), head);
@@ -2737,7 +2737,6 @@ int split_huge_page_to_list(struct page *page, struct list_head *list)
 
 	/* Prevent deferred_split_scan() touching ->_refcount */
 	spin_lock(&ds_queue->split_queue_lock);
-	count = page_count(head);
 	mapcount = total_mapcount(head);
 	if (!mapcount && page_ref_freeze(head, 1 + extra_pins)) {
 		if (!list_empty(page_deferred_list(head))) {
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] mm/huge_memory.c: remove unused variable 'count'
  2021-05-14  6:59 [PATCH -next] mm/huge_memory.c: remove unused variable 'count' Pu Lehui
@ 2021-05-14 18:48 ` Yang Shi
  0 siblings, 0 replies; 2+ messages in thread
From: Yang Shi @ 2021-05-14 18:48 UTC (permalink / raw)
  To: Pu Lehui; +Cc: Andrew Morton, Linux MM, Linux Kernel Mailing List

On Thu, May 13, 2021 at 11:59 PM Pu Lehui <pulehui@huawei.com> wrote:
>
> mm/huge_memory.c:2663:6: warning:
>  variable ‘count’ set but not used [-Wunused-but-set-variable]
>   2663 |  int count, mapcount, extra_pins, ret;
>        |      ^~~~~
>
> This variable is not used in function , this commit
> remove it to fix the warning.

Thanks for catching this warning. Not sure why my gcc 10 doesn't catch
this warning at all. What compiler are you using?

Andrew, the compile warning was introduced by my
mm-thp-check-total_mapcount-instead-of-page_mapcount.patch.
>
> Signed-off-by: Pu Lehui <pulehui@huawei.com>
> ---
>  mm/huge_memory.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 52ca04b905cf..a23a127302e9 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -2660,7 +2660,7 @@ int split_huge_page_to_list(struct page *page, struct list_head *list)
>         struct deferred_split *ds_queue = get_deferred_split_queue(head);
>         struct anon_vma *anon_vma = NULL;
>         struct address_space *mapping = NULL;
> -       int count, mapcount, extra_pins, ret;
> +       int mapcount, extra_pins, ret;
>         pgoff_t end;
>
>         VM_BUG_ON_PAGE(is_huge_zero_page(head), head);
> @@ -2737,7 +2737,6 @@ int split_huge_page_to_list(struct page *page, struct list_head *list)
>
>         /* Prevent deferred_split_scan() touching ->_refcount */
>         spin_lock(&ds_queue->split_queue_lock);
> -       count = page_count(head);
>         mapcount = total_mapcount(head);
>         if (!mapcount && page_ref_freeze(head, 1 + extra_pins)) {
>                 if (!list_empty(page_deferred_list(head))) {
> --
> 2.17.1
>
>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-14 18:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-14  6:59 [PATCH -next] mm/huge_memory.c: remove unused variable 'count' Pu Lehui
2021-05-14 18:48 ` Yang Shi

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).