From: Andrew Morton <akpm@linux-foundation.org>
To: Qian Cai <cai@lca.pw>
Cc: willy@infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/hugepages: fix "orig_pud" set but not used
Date: Fri, 1 Mar 2019 13:09:51 -0800 [thread overview]
Message-ID: <20190301130951.67f419011da93265d36226cc@linux-foundation.org> (raw)
In-Reply-To: <20190301004903.89514-1-cai@lca.pw>
On Thu, 28 Feb 2019 19:49:03 -0500 Qian Cai <cai@lca.pw> wrote:
> The commit a00cc7d9dd93 ("mm, x86: add support for PUD-sized transparent
> hugepages") introduced pudp_huge_get_and_clear_full() but no one uses
> its return code, so just make it void.
>
> mm/huge_memory.c: In function 'zap_huge_pud':
> mm/huge_memory.c:1982:8: warning: variable 'orig_pud' set but not used
> [-Wunused-but-set-variable]
> pud_t orig_pud;
> ^~~~~~~~
>
> ...
>
> --- a/include/asm-generic/pgtable.h
> +++ b/include/asm-generic/pgtable.h
> @@ -167,11 +167,11 @@ static inline pmd_t pmdp_huge_get_and_clear_full(struct mm_struct *mm,
> #endif
>
> #ifndef __HAVE_ARCH_PUDP_HUGE_GET_AND_CLEAR_FULL
> -static inline pud_t pudp_huge_get_and_clear_full(struct mm_struct *mm,
> - unsigned long address, pud_t *pudp,
> - int full)
> +static inline void pudp_huge_get_and_clear_full(struct mm_struct *mm,
> + unsigned long address,
> + pud_t *pudp, int full)
> {
> - return pudp_huge_get_and_clear(mm, address, pudp);
> + pudp_huge_get_and_clear(mm, address, pudp);
> }
Not sure this is a good change. Future callers might want that return
value.
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -1979,7 +1979,6 @@ spinlock_t *__pud_trans_huge_lock(pud_t *pud, struct vm_area_struct *vma)
> int zap_huge_pud(struct mmu_gather *tlb, struct vm_area_struct *vma,
> pud_t *pud, unsigned long addr)
> {
> - pud_t orig_pud;
> spinlock_t *ptl;
>
> ptl = __pud_trans_huge_lock(pud, vma);
> @@ -1991,8 +1990,7 @@ int zap_huge_pud(struct mmu_gather *tlb, struct vm_area_struct *vma,
> * pgtable_trans_huge_withdraw after finishing pudp related
> * operations.
> */
> - orig_pud = pudp_huge_get_and_clear_full(tlb->mm, addr, pud,
> - tlb->fullmm);
> + pudp_huge_get_and_clear_full(tlb->mm, addr, pud, tlb->fullmm);
In fact this code perhaps should be passing orig_pud into
pudp_huge_get_and_clear_full(). That could depend on what future
per-arch implementations of pudp_huge_get_and_clear_full() choose to
do.
Anyway, I'll await Matthew's feedback.
next prev parent reply other threads:[~2019-03-01 21:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-01 0:49 Qian Cai
2019-03-01 21:09 ` Andrew Morton [this message]
2019-03-01 21:44 ` Matthew Wilcox
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=20190301130951.67f419011da93265d36226cc@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=cai@lca.pw \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=willy@infradead.org \
/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
all inboxes | Powered by JetHome®