From: kernel test robot <lkp@intel.com>
To: kernel@openeuler.org
Cc: oe-kbuild-all@lists.linux.dev
Subject: [openeuler:OLK-6.6 1360/2445] mm/share_pool.c:1468:7: warning: variable 'is_hugepage' set but not used
Date: Fri, 19 Jan 2024 20:58:02 +0800 [thread overview]
Message-ID: <202401192029.BVlaRTDd-lkp@intel.com> (raw)
tree: https://gitee.com/openeuler/kernel.git OLK-6.6
head: 8d727c541fb1354691d382ff487a8c37162c75c2
commit: eaafc4a2a3fd023a99c44286895074dd5712706f [1360/2445] mm/sharepool: Implement mg_sp_unshare_kva
config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20240119/202401192029.BVlaRTDd-lkp@intel.com/config)
compiler: clang version 18.0.0git (https://github.com/llvm/llvm-project 9bde5becb44ea071f5e1fa1f5d4071dc8788b18c)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240119/202401192029.BVlaRTDd-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401192029.BVlaRTDd-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> mm/share_pool.c:1468:7: warning: variable 'is_hugepage' set but not used [-Wunused-but-set-variable]
1468 | bool is_hugepage = true;
| ^
mm/share_pool.c:73:12: warning: unused variable 'system_group_count' [-Wunused-variable]
73 | static int system_group_count;
| ^~~~~~~~~~~~~~~~~~
mm/share_pool.c:76:19: warning: unused variable 'sp_group_idr' [-Wunused-variable]
76 | static DEFINE_IDR(sp_group_idr);
| ^~~~~~~~~~~~
include/linux/idr.h:56:37: note: expanded from macro 'DEFINE_IDR'
56 | #define DEFINE_IDR(name) struct idr name = IDR_INIT(name)
| ^~~~
mm/share_pool.c:223:20: warning: unused function 'sp_add_group_master' [-Wunused-function]
223 | static inline void sp_add_group_master(struct sp_group_master *master)
| ^~~~~~~~~~~~~~~~~~~
mm/share_pool.c:230:20: warning: unused function 'sp_del_group_master' [-Wunused-function]
230 | static inline void sp_del_group_master(struct sp_group_master *master)
| ^~~~~~~~~~~~~~~~~~~
mm/share_pool.c:237:13: warning: unused function 'meminfo_init' [-Wunused-function]
237 | static void meminfo_init(struct sp_meminfo *meminfo)
| ^~~~~~~~~~~~
mm/share_pool.c:274:20: warning: unused function 'meminfo_alloc_sum_byKB' [-Wunused-function]
274 | static inline long meminfo_alloc_sum_byKB(struct sp_meminfo *meminfo)
| ^~~~~~~~~~~~~~~~~~~~~~
mm/share_pool.c:279:20: warning: unused function 'meminfo_k2u_size' [-Wunused-function]
279 | static inline long meminfo_k2u_size(struct sp_meminfo *meminfo)
| ^~~~~~~~~~~~~~~~
mm/share_pool.c:284:25: warning: unused function 'meminfo_total_size' [-Wunused-function]
284 | static inline long long meminfo_total_size(struct sp_meminfo *meminfo)
| ^~~~~~~~~~~~~~~~~~
mm/share_pool.c:380:13: warning: unused function 'sp_mapping_detach' [-Wunused-function]
380 | static void sp_mapping_detach(struct sp_group *spg, struct sp_mapping *spm)
| ^~~~~~~~~~~~~~~~~
mm/share_pool.c:438:12: warning: unused function 'sp_group_setup_mapping_normal' [-Wunused-function]
438 | static int sp_group_setup_mapping_normal(struct mm_struct *mm, struct sp_group *spg)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mm/share_pool.c:485:13: warning: unused function 'update_mem_usage_alloc' [-Wunused-function]
485 | static void update_mem_usage_alloc(unsigned long size, bool inc,
| ^~~~~~~~~~~~~~~~~~~~~~
mm/share_pool.c:497:13: warning: unused function 'update_mem_usage_k2u' [-Wunused-function]
497 | static void update_mem_usage_k2u(unsigned long size, bool inc,
| ^~~~~~~~~~~~~~~~~~~~
mm/share_pool.c:582:22: warning: unused function 'spa_size' [-Wunused-function]
582 | static unsigned long spa_size(struct sp_area *spa)
| ^~~~~~~~
mm/share_pool.c:587:21: warning: unused function 'spa_file' [-Wunused-function]
587 | static struct file *spa_file(struct sp_area *spa)
| ^~~~~~~~
mm/share_pool.c:791:24: warning: unused function 'sp_area_alloc' [-Wunused-function]
791 | static struct sp_area *sp_area_alloc(unsigned long size, unsigned long flags,
| ^~~~~~~~~~~~~
mm/share_pool.c:944:24: warning: unused function 'sp_area_get' [-Wunused-function]
944 | static struct sp_area *sp_area_get(struct sp_group *spg,
| ^~~~~~~~~~~
mm/share_pool.c:1005:13: warning: unused function 'sp_area_put_locked' [-Wunused-function]
1005 | static void sp_area_put_locked(struct sp_area *spa)
| ^~~~~~~~~~~~~~~~~~
18 warnings generated.
vim +/is_hugepage +1468 mm/share_pool.c
1460
1461 /* No possible concurrent protection, take care when use */
1462 static int sp_unshare_kva(unsigned long kva, unsigned long size)
1463 {
1464 unsigned long addr, kva_aligned;
1465 struct page *page;
1466 unsigned long size_aligned;
1467 unsigned long step;
> 1468 bool is_hugepage = true;
1469 int ret;
1470
1471 ret = is_vmap_hugepage(kva);
1472 if (ret > 0) {
1473 kva_aligned = ALIGN_DOWN(kva, PMD_SIZE);
1474 size_aligned = ALIGN(kva + size, PMD_SIZE) - kva_aligned;
1475 step = PMD_SIZE;
1476 } else if (ret == 0) {
1477 kva_aligned = ALIGN_DOWN(kva, PAGE_SIZE);
1478 size_aligned = ALIGN(kva + size, PAGE_SIZE) - kva_aligned;
1479 step = PAGE_SIZE;
1480 is_hugepage = false;
1481 } else {
1482 pr_err_ratelimited("check vmap hugepage failed %d\n", ret);
1483 return -EINVAL;
1484 }
1485
1486 if (kva_aligned + size_aligned < kva_aligned) {
1487 pr_err_ratelimited("overflow happened in unshare kva\n");
1488 return -EINVAL;
1489 }
1490
1491 for (addr = kva_aligned; addr < (kva_aligned + size_aligned); addr += step) {
1492 page = vmalloc_to_page((void *)addr);
1493 if (page)
1494 put_page(page);
1495 else
1496 WARN(1, "vmalloc %pK to page/hugepage failed\n",
1497 (void *)addr);
1498 }
1499
1500 vunmap((void *)kva_aligned);
1501
1502 return 0;
1503 }
1504
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2024-01-19 12:59 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=202401192029.BVlaRTDd-lkp@intel.com \
--to=lkp@intel.com \
--cc=kernel@openeuler.org \
--cc=oe-kbuild-all@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.