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 26013C4332F for ; Sat, 19 Nov 2022 00:37:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 824976B0072; Fri, 18 Nov 2022 19:37:24 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7D41E6B0073; Fri, 18 Nov 2022 19:37:24 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 69B926B0074; Fri, 18 Nov 2022 19:37:24 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 5A2C46B0072 for ; Fri, 18 Nov 2022 19:37:24 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 27A34AAB8B for ; Sat, 19 Nov 2022 00:37:24 +0000 (UTC) X-FDA: 80148328008.17.164DDC1 Received: from mail-qv1-f42.google.com (mail-qv1-f42.google.com [209.85.219.42]) by imf06.hostedemail.com (Postfix) with ESMTP id CD064180007 for ; Sat, 19 Nov 2022 00:37:23 +0000 (UTC) Received: by mail-qv1-f42.google.com with SMTP id e15so4470645qvo.4 for ; Fri, 18 Nov 2022 16:37:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=dyEPY+SojRhqXF/AvB0DrGy+gEBy7oa95tVCQD643p0=; b=no0Tfx19bBOZUAeRN3mzYn4qcd7kLI8jUwU9vN5lbhqXXNIoo1QCS2A9e6LG4U0Or7 QY2bB2l5Z3pUGj2gA9Aw/njcKYwjrfj/oKHgw2oEwiMqbIA8R9sEtQ8zlmC3WWdzdmNd G4sNIs8QA/OoRGYnozf7yuka7VeDzAz+HGgy8wS6MENGIVT/XVNPQS96wwktYfdNVP7u K85AkTOjPQO/E7XCXBLuON5090rAPuzDsAEF8Gk6j8SKh0VQfJigAOHRFV/IeZ0Rkm/b FHPSt5HAkVZa+wj/or5IYfzxpf0C44y8QoXeTYMHrgvDBRp2t1fj4bLYw2HK9ShEsuBM GpmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=dyEPY+SojRhqXF/AvB0DrGy+gEBy7oa95tVCQD643p0=; b=C2BE8RbJUTniivlRZomKATS6uxlDihL80NAuVLhhf67p6Wyh/HF+OvzwR3ucpZmj3x t/DcJbrVB8E8/qF2SrkBeEzI2vXGGH9x2bJxbc0ko5V31U7YUDy8GbGpCBcnDL12uKCD zbQJuuk47WHNd4pRWZSVJO2J6uLXzosmkXSvjR+dfdboLYDx3G1F0mDBR4JoaNEiYc93 v/RFm9oNcQ7E/x7EW3mNlVZwmZ0r9DTjRbx7G6owFAz3Ijl/2faF/OEyE3fTIBVD+cwK /XE4f44KqjX833JTfP7R+uJpxbWAi7MU01yAQhU5Q7muXVfePYw3lykzHs3M95j5qjgn EkPQ== X-Gm-Message-State: ANoB5pmnErXKmwXg2fg1RbTZov6wOaxodwVXVMvYHAfiBJFrqg0JY01/ yJc2tLvl1Qi3PqvCcw8hnZZqNw== X-Google-Smtp-Source: AA0mqf6fsjaaxYUp3xx21CcJ8zpCHmptZyty/Ag71ufur/HJeNekLLxWkxwOOWjGfITrpe30FuE7mA== X-Received: by 2002:a0c:9c43:0:b0:4c6:62af:5e17 with SMTP id w3-20020a0c9c43000000b004c662af5e17mr8967454qve.95.1668818242976; Fri, 18 Nov 2022 16:37:22 -0800 (PST) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id ay20-20020a05620a179400b006faa88ba2b5sm3461329qkb.7.2022.11.18.16.37.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 16:37:21 -0800 (PST) Date: Fri, 18 Nov 2022 16:37:12 -0800 (PST) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Yu Zhao cc: Hugh Dickins , Andrew Morton , Linus Torvalds , Johannes Weiner , "Kirill A. Shutemov" , Matthew Wilcox , David Hildenbrand , Vlastimil Babka , Peter Xu , Yang Shi , John Hubbard , Mike Kravetz , Sidhartha Kumar , Muchun Song , Miaohe Lin , Naoya Horiguchi , Mina Almasry , James Houghton , Zach O'Keefe , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 1/3] mm,thp,rmap: subpages_mapcount of PTE-mapped subpages In-Reply-To: Message-ID: <759077a6-a08-5bb0-a0b6-53be2fe8b56a@google.com> References: <5f52de70-975-e94f-f141-543765736181@google.com> <78fa518-85b5-32c0-ee92-537fa46131f6@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1668818243; a=rsa-sha256; cv=none; b=g9EZs4RloFAk9Y9/f7iWp8i5hdV4xkZrQXYCkLMSHggpPWxImMb9OBYd1bJIgujHy6AR7l P3L233hVrM6E0zefT7VntAHMmkT18uFbd48kxlaENNzq6RVoIC1/rWDhLkDVPqLX2r4XRL +mOGQUOjzHwNeZQ8FcSwrp+iYD6YD20= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=no0Tfx19; spf=pass (imf06.hostedemail.com: domain of hughd@google.com designates 209.85.219.42 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668818243; 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:in-reply-to:references:references:dkim-signature; bh=dyEPY+SojRhqXF/AvB0DrGy+gEBy7oa95tVCQD643p0=; b=io43bEhdTYNcZlannKm8VKSKGA0N/0dmdus4b+xq2j04YVsD+OrTLJPb55W4/9/DlQEvnL rOqCglIJZ/UsVcs6BImJlznQ4lcF/Y85Q92G6N8Q394dENGKjC4bAonX8o4Z1D+CKoQtIW EFuI9ee6CPSR5uPKXUAFNuD5Y1yJPdQ= X-Stat-Signature: pnu7emopmeiqh5jxkkmradw7srsdgzym X-Rspamd-Queue-Id: CD064180007 X-Rspamd-Server: rspam01 X-Rspam-User: Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=no0Tfx19; spf=pass (imf06.hostedemail.com: domain of hughd@google.com designates 209.85.219.42 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com X-HE-Tag: 1668818243-989943 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: On Fri, 18 Nov 2022, Yu Zhao wrote: > On Fri, Nov 18, 2022 at 2:12 AM Hugh Dickins wrote: > > ... > > > @@ -1308,31 +1285,29 @@ void page_add_anon_rmap(struct page *page, ... > > > > VM_BUG_ON_PAGE(!first && (flags & RMAP_EXCLUSIVE), page); > > Hi Hugh, I got the following warning from the removed "else" branch. > Is it legit? Thanks. > > mm/rmap.c:1236:13: warning: variable 'first' is used uninitialized > whenever 'if' condition is false [-Wsometimes-uninitialized] > } else if (PageTransHuge(page)) { > ^~~~~~~~~~~~~~~~~~~ > mm/rmap.c:1248:18: note: uninitialized use occurs here > VM_BUG_ON_PAGE(!first && (flags & RMAP_EXCLUSIVE), page); > ^~~~~ Thanks a lot for that. From the compiler's point of view, it is certainly a legit warning. From our point of view, it's unimportant, because we know that page_add_anon_rmap() should only ever be called with compound true when PageTransHuge(page) (and should never be called with compound true when TRANSPARENT_HUGEPAGE is disabled): so it's a "system error" if first is uninitialized there. But none of us want a compiler warning: I'll follow up with a fix patch, when I've decided whether it's better initialized to true or to false in the impossible case... Although the same pattern is used in other functions, this is the only one of them which goes on to use "first" or "last" afterwards. Hugh