From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1367C369A4 for ; Wed, 9 Apr 2025 00:40:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5F5B66B00DA; Tue, 8 Apr 2025 20:40:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5A4E26B00DD; Tue, 8 Apr 2025 20:40:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 446606B0112; Tue, 8 Apr 2025 20:40:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 25B406B00DA for ; Tue, 8 Apr 2025 20:40:02 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 638CAAFBC6 for ; Wed, 9 Apr 2025 00:40:03 +0000 (UTC) X-FDA: 83312648286.18.A6C6F10 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf06.hostedemail.com (Postfix) with ESMTP id C304718000C for ; Wed, 9 Apr 2025 00:40:01 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=QjYyByEc; dmarc=none; spf=pass (imf06.hostedemail.com: domain of akpm@linux-foundation.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1744159201; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=pZ9AbIy5aLcYKi/RqygNWkY2/hmRtCZStgpZ9/ocAk4=; b=x5LRhycGHI/z2GEoGsC10mzJOjNNujgBPEIKaJDleR5jvLmodPch+QPh2F7SiTh/plfu2r wJ8jAa68PbvARjmlnf0ZY87fVRZXETLCtXzu7+ObMtIdO5uQ3a7h87POsujPMGtmRBn736 qxEuiH9Uct7VT4gviWQ3Sxvsj1ZHUxM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1744159201; a=rsa-sha256; cv=none; b=1Y+WZufukHVuZcOyaBkMve9POXmH+2/l+DBkVd7YGHMNDvINQLDSd7XZOiC3+B2r/JBpgr 7blQL6KT5KYp8Rj//NTgfG8xnSN67WgZfHjzy1m+wY+BcB1pztcNOOSXO1+DMRvIfxqMQm 2z41NYwsWW8+e7ouIlIYYpdK80YTW2w= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=QjYyByEc; dmarc=none; spf=pass (imf06.hostedemail.com: domain of akpm@linux-foundation.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 58DEEA496DA; Wed, 9 Apr 2025 00:34:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7727BC4CEE5; Wed, 9 Apr 2025 00:40:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1744159200; bh=ePBmpq2a4DMQiWyTZzEf6l0GwjldfvvKxuZRaNZTn0o=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=QjYyByEc3E3N6AkWFipwvkl3ysx8PP88WA19yKHQ3uCvmPIHVE9v8I4X7XILpSQ17 5puxONq23M0m5yAKXPRkXTudz++lyihLCuT61Oyk1olPZKGBlUlG9jryQAWz1saNcr cngyuLl06Qgx4WelEHGYQewj8nH9XHRxiqiT7f0I= Date: Tue, 8 Apr 2025 17:39:59 -0700 From: Andrew Morton To: kernel test robot Cc: Kemeng Shi , llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev, Linux Memory Management List , Tim Chen , Baoquan He Subject: Re: [linux-next:master 1753/1936] mm/swapfile.c:1517:20: warning: function 'swap_is_last_ref' is not needed and will not be emitted Message-Id: <20250408173959.f501f65ec5d5e52cefe6b129@linux-foundation.org> In-Reply-To: <202504081841.jbL7yL0r-lkp@intel.com> References: <202504081841.jbL7yL0r-lkp@intel.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: C304718000C X-Stat-Signature: 987c5enj911jjk6n9s8p45z6fu458rxu X-Rspam-User: X-HE-Tag: 1744159201-784829 X-HE-Meta: U2FsdGVkX18FAACamv6O2j7Mo9XSYREfMAztw4FNYKKFGngyybwihTe8V0vbLMgSRAkiGvHuAZ+qrjS40zvD02h8rO6EPihcJJtsAiN9q3km3jqD8fIaKocRgiMx5L1E/rh9VeSlHc1kabBM0e2tHXQ8Mx6XcdNbDfIbyDJAzWK2kNZhzKssgWCPbJdiGdWrEVQmLry/OS9DA+QkjiiBtcnS/Q6CZsgVr7ImZDPShgCkxZwqJpMvQtzpgMm+GQ/TSZRX1jQr6hhdXZfg21FQoOcdO9NLjrzU4cLMR/Hp6+6q3tpUNnPUd3bLa8CGN2CKoFw9XKg2lsOI+WsIW2ZC423ZMjgBHWd7iMwBoo+m18renXLRTb1/7298w4W9gyiAXNXXY5pcefpxy20sf4Mo+eSAJ3EjD6Ds0UwXugY/89ReVnQKlUmA7CSBrMSdutgukTebdUMhvrBTExn6fx7CUWdEt7MoKHpAU7VqEAdAmOspuvLv1W7gTe45M766+pNxLUOA+KXsro2TgbO8H3/mx7zDF1U4PUCXFuqDNKCryLjL6ul2JKhm7tX2m7xtG8aFKakUkuaoxoxi8dpFbtbHX+u2jfRDyg2EIM0/am+xOaQDaSowC+GRtkw0xuX/vFvaGm5ThC3JDderC4exyJO+RR+sE9+kGcTNuDvuipa5gIzPeFhJAa1YAZBcQU0l4XpuQtaVplZ8gW7xTRyqyQ355pYAiZWn6M1Su1YJiqqWEoClNeioIrq7nH3ze8mS9HvAHHbKF1TEOmd9p4C7HKpwJML61DA/5LvzakO7vU1q3tpgbD5M0bSuQ4a2nkXl4y3JJv4QEJVF4Rm+EyR0aCkU/bUGgnFACkNGDENEcyQDuBUD7DmZCElADQ1OiY5sQz/04S8F2EiJvLbhpcjfgfVg6z6oT1XsnMAdkW48N2re7XgUnL5xSvAor6CVLzHmgNVruKs7nTItvmFnSscbIPL tLTt2Unx YpOGbF9iADhG2GdfVcr8KW1fBBbkweMBxmuCD+9aNC4EMH87/JwQci+0c3GmNuoeDDst2OjVeuCLp7PLSCfyOWwPYa4/xcGZ2UFJslxUxf+WW+lpRk2U32m2q5z3idnU4TjtEFAbY76i4kg1bK1igLefSJ8UcfGWb63kC9a4Bd0BXexaPe77ygZjXd3dD1BVcwxvrg9hPeEM8QIwGlMhv5k+P4/rbOSJq6pGgW4O2Kp80Z5/fGnZX9+JeAEC+1saTJkpQE7DJ5QvGNtXuN+D0J7zjNPnGrp3xINS7wiXC+M9Vk11OYMV91Bc1WqsQq/t6VDY0EuapOtLDWPENPEYpqm5attQy48uMZq0u51mU+2nwV3CZ+kolScr5DwVXtDcAZBkkoUlTJv0tqupxx3sQxmbPTCJprO+HkdudiY/iXBXkVRRshoJQ69Cdvtb9vDbv0tjqllpuP7RUxcY= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Tue, 8 Apr 2025 18:06:11 +0800 kernel test robot wrote: > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master > head: 7702d0130dc002bab2c3571ddb6ff68f82d99aea > commit: 6bb001b6b64ec20d900d0d81294a0f031af59c3e [1753/1936] mm: swap: enable swap_entry_range_free() to drop any kind of last ref > config: hexagon-randconfig-001-20250408 (https://download.01.org/0day-ci/archive/20250408/202504081841.jbL7yL0r-lkp@intel.com/config) > compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project 92c93f5286b9ff33f27ff694d2dc33da1c07afdd) > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250408/202504081841.jbL7yL0r-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 > | Closes: https://lore.kernel.org/oe-kbuild-all/202504081841.jbL7yL0r-lkp@intel.com/ > > All warnings (new ones prefixed by >>): > > >> mm/swapfile.c:1517:20: warning: function 'swap_is_last_ref' is not needed and will not be emitted [-Wunneeded-internal-declaration] It's annoying that gcc warns about this. > 1517 | static inline bool swap_is_last_ref(unsigned char count) > | ^~~~~~~~~~~~~~~~ > 1 warning generated. > > > vim +/swap_is_last_ref +1517 mm/swapfile.c > > 1512 > 1513 /* > 1514 * Drop the last ref(1, SWAP_HAS_CACHE or SWAP_MAP_SHMEM) of swap entries, > 1515 * caller have to ensure all entries belong to the same cgroup and cluster. > 1516 */ > > 1517 static inline bool swap_is_last_ref(unsigned char count) > 1518 { > 1519 return (count == SWAP_HAS_CACHE) || (count == 1) || > 1520 (count == SWAP_MAP_SHMEM); > 1521 } > 1522 : static inline bool swap_is_last_ref(unsigned char count) : { : return (count == SWAP_HAS_CACHE) || (count == 1) || : (count == SWAP_MAP_SHMEM); : } : : static void swap_entries_free(struct swap_info_struct *si, : struct swap_cluster_info *ci, : swp_entry_t entry, unsigned int nr_pages) : { : unsigned long offset = swp_offset(entry); : unsigned char *map = si->swap_map + offset; : unsigned char *map_end = map + nr_pages; : : /* It should never free entries across different clusters */ : VM_BUG_ON(ci != offset_to_cluster(si, offset + nr_pages - 1)); : VM_BUG_ON(cluster_is_empty(ci)); : VM_BUG_ON(ci->count < nr_pages); : : ci->count -= nr_pages; : do { : VM_BUG_ON(!swap_is_last_ref(*map)); And it's annoying that VM_BUG_ON() doesn't reference its arg when CONFIG_DEBUG_VM=n. I'll add this: --- a/mm/swapfile.c~mm-swap-enable-swap_entry_range_free-to-drop-any-kind-of-last-ref-fix +++ a/mm/swapfile.c @@ -1514,11 +1514,13 @@ fallback: * Drop the last ref(1, SWAP_HAS_CACHE or SWAP_MAP_SHMEM) of swap entries, * caller have to ensure all entries belong to the same cgroup and cluster. */ +#ifdef CONFIG_DEBUG_VM static inline bool swap_is_last_ref(unsigned char count) { return (count == SWAP_HAS_CACHE) || (count == 1) || (count == SWAP_MAP_SHMEM); } +#endif static void swap_entries_free(struct swap_info_struct *si, struct swap_cluster_info *ci, _ Kemeng, can you please review that comment "Drop the last ref...". >From its positioning it appears to be describing swap_is_last_ref(), but swap_is_last_ref() doesn't do those things.