Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1379102rwb; Fri, 18 Nov 2022 17:54:38 -0800 (PST) X-Google-Smtp-Source: AA0mqf4SUvfs0O7nA/b1lSpBoPSnwNvrgcNBRuIKhfhxH7FxG5+NeM3W7pFKP/jCayoYmIt+7j/S X-Received: by 2002:a63:5d06:0:b0:46f:be60:ad82 with SMTP id r6-20020a635d06000000b0046fbe60ad82mr9102184pgb.34.1668822878201; Fri, 18 Nov 2022 17:54:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668822878; cv=none; d=google.com; s=arc-20160816; b=jE2qqpqjRxRbnQ3CfM8sBWYXjV4bPQGtt1sOh+uI9L117yTfdO+rJbWdYFCwrXfOiB LYgSrNZtJZbgKtaI5OYM03QfKWP9PNRSNm1KX+dlxIAC17M4aXopa8cugV0Nxkx0qrJ0 kDPYb3jmG0aQr3v7iWZwgZ5NSoA8mkGqkS3tCbxBhjNHxTHA1/Lx6uVo8AeztoMn4eMm lafhr69JzbJ4SNSo1l0waKnysmrhOGxI2kW0S7oajn8sEIBJb1VC1Y/O8VoV51F8OsxY r0M0o+gDH70TPIlGg/Kv94+cs03OE+Fya/pMNYcmJbSfUcH2m7fYp5qidjIOoub7wSzU vkqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=dyEPY+SojRhqXF/AvB0DrGy+gEBy7oa95tVCQD643p0=; b=R0PILt5b4LXjtWnAw0Qoi1e3yO7AunJD9d2yOk/OZinLTQGt1/D0dnG3h2hqMtcr2U zc6BgTx95GFePyxvOCjKX75MoeOwxUTgjOy/amPiZcDC/f9Nlj1zPtaOrtOssrX+5q0W TRiyQ22HLns4zjTCZG0JYIYLwIGVkwVXUH2C8Ny9VjBH1fxkhW8pTMomCV1d7v3qEPAB iJOzGlL2ZQo1gWRt85gTOm5fiecV47T/8GzR2zONod9Uwq52j6NZTQ3nkY3F+9qDNvhp 3kjs7aKQubl0pWVivLM5pdjo9dIF73jWy8C7Wysr/YQYVDZrT0SgRGE2FvoXDW5smNn6 xjKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=no0Tfx19; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v64-20020a638943000000b00470086d9f5esi5161907pgd.780.2022.11.18.17.54.27; Fri, 18 Nov 2022 17:54:38 -0800 (PST) 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; dkim=pass header.i=@google.com header.s=20210112 header.b=no0Tfx19; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231891AbiKSBco (ORCPT + 90 others); Fri, 18 Nov 2022 20:32:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231534AbiKSBcU (ORCPT ); Fri, 18 Nov 2022 20:32:20 -0500 Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 087F3116592 for ; Fri, 18 Nov 2022 16:37:23 -0800 (PST) Received: by mail-qv1-xf2f.google.com with SMTP id k2so3283100qvo.1 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=vsStgd5qN3eWHPyKpdiTEKYVqJJ5bButWi4aJDxhsnH8n8D/1EBZcMgIf2EVmj1v3i 4IZDtGM7bMzKwk0GoENylhWrAWjwBjy4AnxSrFp0/TXzwDEyy4VEWenR6h0Nk1HlmTI5 AN/CJfJn3yvAVOyvY20MhBVigTRE0XtP3/PZM/U5NYZbvIFJc/HGPTubY5G68AM3yOOu kGY334HJqUkxHScn9oyg8wS3w8HFCAPNaI9+WZlVu/6b3yQzAwpv5Vv3KEfOD7LdoBeD e3excixqSaFOXGxhiGhGr4kadaNrI98hgjc7pzXuqKS/dAXukHITKCKp2dQiT/vr076V bgiw== X-Gm-Message-State: ANoB5pkRVWgoZM1kvcRk+quMkbUyo/IweZGlGF9y2z8TdHVjVRA2hRp4 dZqjMblAqlK0M4/1L8bmY3b1Aw== 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 X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham 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 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