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 4D2ABC43334 for ; Tue, 14 Jun 2022 11:33:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BB3888D0002; Tue, 14 Jun 2022 07:33:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B64A86B009B; Tue, 14 Jun 2022 07:33:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A2B1C8D0002; Tue, 14 Jun 2022 07:33:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 909D36B0095 for ; Tue, 14 Jun 2022 07:33:50 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 5E85E351B1 for ; Tue, 14 Jun 2022 11:33:50 +0000 (UTC) X-FDA: 79576631820.17.D3517D3 Received: from mail-yw1-f169.google.com (mail-yw1-f169.google.com [209.85.128.169]) by imf24.hostedemail.com (Postfix) with ESMTP id F413618008D for ; Tue, 14 Jun 2022 11:33:49 +0000 (UTC) Received: by mail-yw1-f169.google.com with SMTP id 00721157ae682-30ce6492a60so26134697b3.8 for ; Tue, 14 Jun 2022 04:33:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to:cc; bh=aQCHD8TYAVlZR0413zgla4M7zGjkgHK1BYJdrHmcBtg=; b=W3YOp8+Llm1RjUKQKSdz5ypS3lVt61deoFSQSZkdR9ZIYo/QytA4B60dkRtQVyq81Q oia1aOtw8LjO8EWMJWkt7NiYWjfYwcEG6IudtpTtEh/A7+YZTnrcIpUjuK+gjKWA1Hf+ DOaV6TzA5xfR/42u8jTiUtIB1hFpAUCcTLOn0tjXsrdTirROREmyTzQbODt5BAd+TveK sH/fquNVLUa4Lt6hrWs2YRJrc2ucH7CMN2MBUivphcHzx7E+hHdW5lkFgl1NMBVDnzwO iDeZSwhEmKUpHmFHWJL0N+HD7rVDZcPH4mBvzYeY4/sTwuxdbJusewMQgp+0fMOyWl+b Gyzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=aQCHD8TYAVlZR0413zgla4M7zGjkgHK1BYJdrHmcBtg=; b=1WFOPS6cAS7ePgmoKaFYM+NtPEQonOzUBjULbQ4/OfQT9L4WgElmkcK9x7pZWvpmD+ Itjr2FRiimp79EIu/A7APQ3qLqloncAV3PCHxo51Qbn0FxZrfXgfdAYpdn4MT3yYkCAz NyrdAtEpG3WEugi83Voatf9PsqKkWmWI7KEfWhsOtVA+AXPnoZQ8NQSyphMEvDhn24nM fS3YjItuF48vxGKyhrZ7D+BKjWV3oWQAgaePcRYiAC6HblxSgl/zvLRoDudbZ/ngX2Mw rJqLoRaDGRnpEvHjtIbX/hNZhQLfbTlsYdvZz+PBtK/hfHEeRwI6u9mHrjp/ygFB7Tp8 xpQg== X-Gm-Message-State: AJIora+XOAPe1+UruxywluR7b8wuPbF46fPIy/Gv68CMOmVUuLYp7D9b HQwG4UwNfHVk9TI/GEXNfDmx8itRPpGfBW4WVw8= X-Google-Smtp-Source: AGRyM1ut27JCQ8mv5IUs9u8PZmcphZfw636b8ePw820EY2mvjW/j2kyPN9Or6Oebof6zY/BKZgXS1s3UMQ+shhOTcNQ= X-Received: by 2002:a0d:e691:0:b0:314:34e7:c562 with SMTP id p139-20020a0de691000000b0031434e7c562mr5090486ywe.237.1655206429176; Tue, 14 Jun 2022 04:33:49 -0700 (PDT) MIME-Version: 1.0 From: Lukas Bulwahn Date: Tue, 14 Jun 2022 13:33:38 +0200 Message-ID: Subject: Issue in count_mm_mlocked_page_nr() with commit afcf76df48f9 ("mm/mlock: use vma iterator and maple state instead of vma linked list") To: "Matthew Wilcox (Oracle)" , "Liam R. Howlett" , "maple-tree@lists.infradead.org" Cc: Linux-MM , Linux Kernel Mailing List , Andrew Morton , kernel-janitors Content-Type: text/plain; charset="UTF-8" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655206430; a=rsa-sha256; cv=none; b=y2vj6TU7Bwl9xqu9BDfpMFLLLMca2xBGER9NOeDhr2QvRHaMThIBwgeznrqfU7jevVrW6h f9K/qeCF4E61Y7LjGu9FWEpaXFcPRFPLT3NgRWe6GsgPvcV4ZJQBN9Wh6isiHSxyoloF3U TeO+sn7rLxHX/cnJ1u5KHPGkhhGMfsI= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=W3YOp8+L; spf=pass (imf24.hostedemail.com: domain of lukas.bulwahn@gmail.com designates 209.85.128.169 as permitted sender) smtp.mailfrom=lukas.bulwahn@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655206430; 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:in-reply-to: references:dkim-signature; bh=aQCHD8TYAVlZR0413zgla4M7zGjkgHK1BYJdrHmcBtg=; b=Rmu9sF/4tRejuJlPhjYO73Vfq9gyOTYpWPEfM0COUhzfS6ycJjgHRZI3foDe8jre23UNdd /EjfLJjROzmWcxDJ8pjv64jOHmh8b0az/VL6OzD9jOUNV0oV9N+AnBlXw8FAtrt0i2c9/9 tuh4US18c1l1ANm4qWItgAFmemhiih0= X-Stat-Signature: qrnts3kd9q944355nzq8ewy4j5oxwmrr X-Rspamd-Queue-Id: F413618008D Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=W3YOp8+L; spf=pass (imf24.hostedemail.com: domain of lukas.bulwahn@gmail.com designates 209.85.128.169 as permitted sender) smtp.mailfrom=lukas.bulwahn@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam07 X-Rspam-User: X-HE-Tag: 1655206429-391973 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: Dear Matthew, dear Liam, The commit afcf76df48f9 ("mm/mlock: use vma iterator and maple state instead of vma linked list") refactors the function count_mm_mlocked_page_nr() in mm/mlock.c, such that the special case: if (mm == NULL) mm = current->mm; is now dead code. Before the refactoring, after this if statement, the variable mm was used further in vma = find_vma(mm, start) in the following line, but now, with the introduction of VMA_ITERATOR(vmi, mm, start) before the if statement, the assignment within the if statement is simply ignored. I assume that: - If the semantics of this function shall be preserved, the VMA_ITERATOR macro needs to move after the if statement. - or, if the consideration of the special case on mm == NULL is actually obsolete with this refactoring, it could be simply deleted. I will keep it up to you how this issue is correctly resolved. This was discovered due to tracking all dead stores that clang-analyzer reports on an x86 defconfig. The underlying issue here is more severe than "just a dead store in the kernel code base", but it is probably easy for you to resolve. Best regards, Lukas P.S.: Sorry, if you get this mail twice, the first time my email client tricked me into unintentionally sending a HTML email rather than a text email.