Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp478384rwl; Wed, 5 Apr 2023 03:39:30 -0700 (PDT) X-Google-Smtp-Source: AKy350ZF+t/Qa5LVLZl5yUcbboUUmuSeAVXegW7BNIddj3naW42v0tzdrK0MmmG4CAlbmOlmhYwM X-Received: by 2002:a17:90b:4a81:b0:237:ae7c:1594 with SMTP id lp1-20020a17090b4a8100b00237ae7c1594mr6516667pjb.8.1680691170170; Wed, 05 Apr 2023 03:39:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680691170; cv=none; d=google.com; s=arc-20160816; b=tm83s1s6mQG1vVbl0xQVq1Km8rdtzcEt8ACayBImkJ8y5f58+5CuaNL9qknOzlUp49 HCKW9x5wIXMT5bD7/yXODhkJk1r7ju7tyhaJkTQvr5zgoLr0UBSqe2fahmEjSmSzzZaE SeQzhT4oaeldVTv1oMxfEKoOheOj0LYo44+YbqAE613s8XcsZ3RofRZptZcwjQvgUX7t unI08umRPN/hnLCWdPbGyNG/Sz1nglp02pLZX6PLE0FwOTHMX6SPx+mA0pJzVNjOIBvH LQyi3fshGQHmlE6joCSgjqrOYimkRHeybtc33J7+vSSgjCC0wfc003ottZql+kJ78KER cTEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=kf+DC2iBMOnhFzcpVswFAc+ozqOC5H7vXXkswxjm1+c=; b=YUUoSLCmFG2/dVhn4gX81cUICy34lvHykkrOPZ4+A8gvBDxb9nFyG66l2dZ+FGuaaL 9yP80zJHiULEuBhrf3hID7JKzEPePFaq60GeGmnm2So6dK3lb37C7fEW2WZ5UjWAUBTo +rgzMMVrk2fc3aaae3PTSqlpDpp9IhmFYRzpujQpvfKrPWRmAnWHIgz6fN/4czIAUwMm GStviGOnMmw7raGWTL8jmEMxCA0HvkItoxFC81z94ZYvK3hkDazat51L6I2M45VhQgkT Vj6/syOO/Yks+nhXELscenz4wYNP4YRhR7Mc1W/T4JpIU/eZma9NR/Mfx4SBeLx7DFAD PNRA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jh15-20020a170903328f00b0019ca3e987dbsi11468129plb.631.2023.04.05.03.39.18; Wed, 05 Apr 2023 03:39:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237467AbjDEKij (ORCPT + 99 others); Wed, 5 Apr 2023 06:38:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230093AbjDEKii (ORCPT ); Wed, 5 Apr 2023 06:38:38 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B252349F9; Wed, 5 Apr 2023 03:38:36 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A73451684; Wed, 5 Apr 2023 03:39:20 -0700 (PDT) Received: from e122027.arm.com (unknown [10.57.94.33]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 684223F73F; Wed, 5 Apr 2023 03:38:34 -0700 (PDT) From: Steven Price To: Andrew Morton Cc: Steven Price , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Jason Gunthorpe , Thomas Hellstrom , Christoph Hellwig , kernel test robot Subject: [PATCH v2] smaps: Fix defined but not used smaps_shmem_walk_ops Date: Wed, 5 Apr 2023 11:38:19 +0100 Message-Id: <20230405103819.151246-1-steven.price@arm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When !CONFIG_SHMEM smaps_shmem_walk_ops is defined but not used, triggering a compiler warning. To avoid the warning remove the #ifdef around the usage. This has no effect because shmem_mapping() is a stub returning false when !CONFIG_SHMEM so the code will be compiled out, however we now need to also provide a stub for shmem_swap_usage(). Fixes: 7b86ac3371b7 ("pagewalk: separate function pointers from iterator data") Reported-by: kernel test robot Link: https://lore.kernel.org/oe-kbuild-all/202304031749.UiyJpxzF-lkp@intel.com/ Signed-off-by: Steven Price --- I've implemented Jason's suggestion of removing the #ifdef around the usage and prodiving a stub for shmem_swap_usage() instead. fs/proc/task_mmu.c | 3 +-- include/linux/shmem_fs.h | 7 +++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 6a96e1713fd5..cb49479acd2e 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -782,7 +782,6 @@ static void smap_gather_stats(struct vm_area_struct *vma, if (start >= vma->vm_end) return; -#ifdef CONFIG_SHMEM if (vma->vm_file && shmem_mapping(vma->vm_file->f_mapping)) { /* * For shared or readonly shmem mappings we know that all @@ -803,7 +802,7 @@ static void smap_gather_stats(struct vm_area_struct *vma, ops = &smaps_shmem_walk_ops; } } -#endif + /* mmap_lock is held in m_start */ if (!start) walk_page_vma(vma, ops, mss); diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h index 103d1000a5a2..762c37b32bd4 100644 --- a/include/linux/shmem_fs.h +++ b/include/linux/shmem_fs.h @@ -94,7 +94,14 @@ int shmem_unuse(unsigned int type); extern bool shmem_is_huge(struct inode *inode, pgoff_t index, bool shmem_huge_force, struct mm_struct *mm, unsigned long vm_flags); +#ifdef CONFIG_SHMEM extern unsigned long shmem_swap_usage(struct vm_area_struct *vma); +#else +static inline unsigned long shmem_swap_usage(struct vm_area_struct *vma) +{ + return 0; +} +#endif extern unsigned long shmem_partial_swap_usage(struct address_space *mapping, pgoff_t start, pgoff_t end); -- 2.34.1