From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1B2B47ECC3 for ; Mon, 2 Mar 2026 20:10:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772482249; cv=none; b=ZWz+TNj3cPFB7hQu6ku+DS1fl/KKjquwuKo5UYzN56DUyg6l2s5yShDuNSiHnH0npKrjibiMBYmyiZdTbGRlqrAdk574bFjWT1sL/W8BpBsLLtVSPNny2KtSLzZ06vSFs2M7xl+G5VhsqPlUvIl0sja3RThcEPAJ+H9bAuXo0ew= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772482249; c=relaxed/simple; bh=BAGy+J+GI1ON6Uhg6h2g7e+9EpkqmmVIzisE/VYdmGc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rEC0Onv7rMHY3/HVdWDJELlavMkxB045QtjnewB2aFQnrNYXtbMoWO48338PWxRwIhgMYHc9HAdrpaPd7NkB70sSkMHAaDusaRxxnz6CQKCE+dvKM5hqbOSgm6T6CJI/clw6UQGx+nolT0eE7yMq0Adou4+KhBJmqdBWPXYyVag= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=R4nRh4vB; arc=none smtp.client-ip=209.85.208.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="R4nRh4vB" Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-65c0891f4e9so8440284a12.1 for ; Mon, 02 Mar 2026 12:10:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772482245; x=1773087045; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OD2UnYjHhMASICcTnuoxYljVdg0QIE7xY6Cey5he4Rc=; b=R4nRh4vBTF6x9Blyl6hV9LmQbP7KaKtZ8tB8VhNLICt0JIgZSjieUORzsW1UI6T6AE j9GtmzpFBruwZ/V1YpJxcbKulS5fcO+GKGYRiSXx6Hc9dy1Xm0HHWFf1txSr0qkDoj9A zNqIKlQdM9VREsFH8ORhmM/EA8//++t+Q9X5JAk9Z2dIWDYonXweTTuq5sDOaswM1qY0 35asIbxCvRLA8L/k9Mx4t57dJ/JQJzY3C2Qa8mx7TJf9BkyTfFtBh0wSzI9QSTB2uNqX AVO+iYxaIXI/t3WEGG7UtlLJgpLw7QuY5bFlOJccS9N3hUOuuYyL58yCTVa9k0ddNTDJ 3ddQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772482245; x=1773087045; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=OD2UnYjHhMASICcTnuoxYljVdg0QIE7xY6Cey5he4Rc=; b=VKrqjGNpUKDyPOSA4ZhXVXNo5ZBduI6HslZqNIpVBZS7cwrxI59u49w3V4HcytU+sR GZFNuLreyUsA+cawAtrWXfjOLuVW6bh+oIsuUBIzL41u+wV8VsrXkUHgb6In7xQYsXtc FqA7oUTIFKzJ1PjOY2NIBOt0GiVDvilgRAW9xg+iA2ndZTq7Cg27LS4xRuhxmuc2v8b4 NEe4JnDdZ5/MdAueTgbG4EYN9C+KIMhHs26DpA1ggiJTSz8EAd+Ygo4ZEUmxQ90qgfPB OiqptZl8H/JLnLWyV+/bTbYOHR6EnDbBFO5bBqSsapXY5JWL1fQw3B58qMgoIysbEAce EYnQ== X-Forwarded-Encrypted: i=1; AJvYcCUaVftG/4UhHX6bBfOiVn2H4ByM4jMeO/k8QX0lt6ziHX1sBrIIp9wPGPsMScFt7URENnI8jf1HwrshWeY=@vger.kernel.org X-Gm-Message-State: AOJu0Yx2/T9GQDoWifwLY723xjaijkZteQkB8hJork8oy6oZIcqiAkOJ y/mcmXyUEI1+nE8r5AEJ0+hE3Cdywx5I8bIlsxbWxguZnaqEiu1+ia5q X-Gm-Gg: ATEYQzzwBu3p6/wAp1IeAcY/loDGyzE829k/M7YxfwvgEzA0WriD1jbNO99ZVM+gUTZ G7jTIeFNwi084cmSDfw5hdg9dNlqbB00fiNF/1gqprGOEmSwMWGa5V4VR5ROg7XFM8jHzsytl67 c7RkpqEkOBMZeTZwSWDscagbcRtinWsytWZRB7wlgJHzZQRwJ9kIiHtKHGGzyuLcTV/+Z6Pslnu VTLvlBHEch8Jzdwct25xJfLw7ECN1Nyw2GAhxMa/SCjvXd8ORFi0DbqZrjtunmCEj/nGQZ+LQCM KnSFZY+j8IvI8ZuZ5jx8Nf7TNLnqSzK+3pWIm+6fzF1IbI7HK01MQ/uM5T2Avm2aKWxHmedbkXg QizGDsr4YuYVuSC0yL7zT2C9koDCec08Tp3w0Y2OE0IivKlp3NDlmkTk+BGbi0osrsKa3IIcDCW Am79FSDfcS2gMH5g2mxKhiKwOF X-Received: by 2002:a05:6402:2355:b0:65c:2af1:b7c1 with SMTP id 4fb4d7f45d1cf-65fde2cfe05mr8198554a12.28.1772482245029; Mon, 02 Mar 2026 12:10:45 -0800 (PST) Received: from ArchLinux ([89.105.203.98]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-65fabd36367sm3835944a12.5.2026.03.02.12.10.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Mar 2026 12:10:44 -0800 (PST) From: Alexey Suchkov X-Google-Original-From: Alexey Suchkov To: joshua.hahnjy@gmail.com Cc: akpm@linux-foundation.org, aleks.koyf@gmail.com, dywoq.contact@gmail.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH] [PATCH v2] mm: initialize 'seq' in gup_fast to remove -Wmaybe-uninitialized warning Date: Mon, 2 Mar 2026 23:09:49 +0300 Message-ID: <20260302201026.39952-1-dywoq.contact@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260302194836.2932150-1-joshua.hahnjy@gmail.com> References: <20260302194836.2932150-1-joshua.hahnjy@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit > Hi Alexey, I hope you're doing well! > > Unfortunately I think that this patch is still unneeded. The variable seq is > used in two places, raw_seqcount_try_begin and read_seqcount_retry, and nowhere > else in the function. Both are guarded by if (gup_flags & FOLL_PIN). > > raw_seqcount_try_begin is a macro that sets the value of seq. > read_seqcount_retry is a macro that indeed reads the value of seq, but at > that point seq has already been initialized by raw_seqcount_try_begin. > So I am having a hard time seeing where it would ever be used in an > uninitialized context. The compiler should be smart enough to expand the > macro, see that the writer and consumer are under the same if conditions, > and realize that it is always initialized before being used. > > I'm curious to know if the compilation warning above is theoretical, or > if you've actually it it during compilation. > > Let me know what you think. Have a great day! > Joshua Hi Joshua, Thanks for your review. I did see this warning in practice with GCC 15.2.1 and "make -j$(nproc) W=2": In function ‘gup_fast’, inlined from ‘gup_fast_fallback’ at mm/gup.c:3202:14: mm/gup.c:3165:20: warning: ‘seq’ may be used uninitialized [-Wmaybe-uninitialized] 3165 | if (read_seqcount_retry(¤t->mm->write_protect_seq, seq)) { | ^ mm/gup.c: In function ‘gup_fast_fallback’: mm/gup.c:3134:18: note: ‘seq’ was declared here 3134 | unsigned seq; | ^~~