mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Steven Price <steven.price@arm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Thomas Hellstrom <thellstrom@vmware.com>,
	Christoph Hellwig <hch@lst.de>, kernel test robot <lkp@intel.com>
Subject: Re: [PATCH] smaps: Fix defined but not used smaps_shmem_walk_ops
Date: Mon, 3 Apr 2023 11:52:58 -0300	[thread overview]
Message-ID: <ZCroShx7wdvYW2lS@ziepe.ca> (raw)
In-Reply-To: <20230403111255.141623-1-steven.price@arm.com>

On Mon, Apr 03, 2023 at 12:12:55PM +0100, Steven Price wrote:
> When !CONFIG_SHMEM smaps_shmem_walk_ops is defined but not used,
> triggering a compiler warning. Surround the definition with an #ifdef to
> keep the compiler happy.
> 
> Fixes: 7b86ac3371b7 ("pagewalk: separate function pointers from iterator data")
> Reported-by: kernel test robot <lkp@intel.com>
> Link: https://lore.kernel.org/oe-kbuild-all/202304031749.UiyJpxzF-lkp@intel.com/
> Signed-off-by: Steven Price <steven.price@arm.com>
> ---
>  fs/proc/task_mmu.c | 2 ++
>  1 file changed, 2 insertions(+)

I think it would be better to enclose the definition of
shmem_swap_usage() in its header with a stub like shmem_mapping and
remove the ifdef completely. shmem_mapping() is already compile time
false.

#ifdef CONFIG_SHMEM
        if (vma->vm_file && shmem_mapping(vma->vm_file->f_mapping)) {
                /*
                 * For shared or readonly shmem mappings we know that all
                 * swapped out pages belong to the shmem object, and we can
                 * obtain the swap value much more efficiently. For private
                 * writable mappings, we might have COW pages that are
                 * not affected by the parent swapped out pages of the shmem
                 * object, so we have to distinguish them during the page walk.
                 * Unless we know that the shmem object (or the part mapped by
                 * our VMA) has no swapped out pages at all.
                 */
                unsigned long shmem_swapped = shmem_swap_usage(vma);

                if (!start && (!shmem_swapped || (vma->vm_flags & VM_SHARED) ||
                                        !(vma->vm_flags & VM_WRITE))) {
                        mss->swap += shmem_swapped;
                } else {
                        ops = &smaps_shmem_walk_ops;
                }
        }
#endif


Jason

      reply	other threads:[~2023-04-03 14:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-03 11:12 Steven Price
2023-04-03 14:52 ` Jason Gunthorpe [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=ZCroShx7wdvYW2lS@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=akpm@linux-foundation.org \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=steven.price@arm.com \
    --cc=thellstrom@vmware.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

all inboxes | Powered by JetHome®