Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2948804rdb; Tue, 13 Feb 2024 02:06:04 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXi7MQ8wr4RMDFBi17q5S/mpNE9azSJWYFq2PTaa5ykiwtL2c513QO+80gIk7yW1OaRd7pmoE1aPPnOlpvkEG9E2lts9ds9TmD6ipKXkQ== X-Google-Smtp-Source: AGHT+IEU/MSKfmOpFvXUxJ4eNfsbWsOzB2m1P1gJUucDccqLnNaVnnGiwwHR4f0AKuHDi1O6Yrwr X-Received: by 2002:a05:6358:9894:b0:179:28:e8a4 with SMTP id q20-20020a056358989400b001790028e8a4mr12113092rwa.31.1707818764139; Tue, 13 Feb 2024 02:06:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707818764; cv=pass; d=google.com; s=arc-20160816; b=LkJcqPeEc4EaRqymSUDMyfJhhtwWa/MQ4zAu5TsHGQpRhZhFemAshvYwCZ2+QjER/y EmHUCtzWU7N7Cwfyw2+i5EJAVRSKLPA36XLH4qVxjOpQeX+gYcirlm7xFbCPnLC1tmac P2WyorKG/yR0UUDft5WltxnHEYbUA8OdU+3AzyhMH/TXE3q1dmNrUxZ7HZFgPm1cZrBs jArTx0YfAeneAWGiJpglwipNOfUMf91phfHhW4BJh2e3AzGsmph3BF0tOATNyoKLlTGJ Ioze+tAf4L/6hBaSqnnzOGq3V7IfArdpUmAL7iG279vu5aPxzDliG/OfjxJvep/wwOry 8u9g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=gHneSwnoLJP21DdMKu2j3JRhkY5arjY1CfMn1GYw+KY=; fh=Sk0rkpn9epOj64grUrHXjUcHqLmvhhumwjbcjBPKHnM=; b=DSkTUL1QMlyF1cgsB7q0tru6kKX/ScRd9gLznf366B7feSLvUpFW+iuyqogUtm6vDg nfR6BsxQnAPPRVi1sWl8lgPqJWm35jtKh5jRhP8jP/GVz9ky/8MwJ574qFqazf9GIbkF jBYyfKi/xeHsa9G4QX0LD6DSQE5QpOZL5gDVJ/+tiJWNW0SA90YkbrSFx2V6tFo62bqr CB3akD5f/wausQXbQ4GIZzcwKSWH4SxGUbfvR1wFVAi6ws1PKrRScxTv/elk5LfBjfJa oBCQVm5BJQ7YNSSoTOHtWaqzNE0r4QuaVzLUQRpbio9RcHDRAH81OaxVUU6euzCe0V7X PFYw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=t3BLbJLW; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-63244-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63244-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org X-Forwarded-Encrypted: i=2; AJvYcCWIdxnW14dq1hFZwmXJXEIL76VNITAW0a5nIm5QlENbLaLqanSiYMsFPohV1vd66uNrNKal9TOZ6u11nNndR/KtQExbQnSK/+nYa9QLfg== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id ka30-20020a056a00939e00b006e0901330e8si6530176pfb.368.2024.02.13.02.06.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 02:06:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63244-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=t3BLbJLW; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-63244-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63244-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 1851CB246C6 for ; Tue, 13 Feb 2024 09:46:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2CEC4335DB; Tue, 13 Feb 2024 09:41:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="t3BLbJLW" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 14856381CF; Tue, 13 Feb 2024 09:41:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707817299; cv=none; b=YqNQEIP1eZou3GulewtKHGAYea9BcrzYI8Xflgl1hLd/QxXWJVKvjFuBuu2s/EC74cVIYWXKUgWDwanJk2CThEqwZJTF7LDF4KJG/lMHiVXVpVP0SMD79WC1SOPF/i4mwqb8MusaO/CVJxywRXMS/O6LNNw4emggMEBuX2heCzg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707817299; c=relaxed/simple; bh=Z/UeRF0PUC7eWwdhWXuxUx7yfttwjE8TQV6RnN3Itw4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=n4Exg1inwiA7u5/ZGcsllPUcy4WgUMUjArnLVUZ/wrb4dkjY/e0Wr75HSU/X5+b+N2qh5E/B75PrgznHcDSv+lv4v0Ivqwox3FOcI+fOgwvZXuoSr786OIWzxB9v5Atdl4fMbBElisW7TRSLNBNjQkgbzrxDXny3+WXjDFTK8tk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=t3BLbJLW; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 407C7C433F1; Tue, 13 Feb 2024 09:41:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1707817298; bh=Z/UeRF0PUC7eWwdhWXuxUx7yfttwjE8TQV6RnN3Itw4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=t3BLbJLW5bXJxoyt4FKCsJFZe99A2CkiIGuDf+4VFnDlEdMoD4AWSLvRgFZQtJbMd mBYuQpULiUn539XaDFyA8S3R8Ggv9ddc3qCpW2FTqnHhb0d4l4QHgOt/6f5cad0ZjJ Mclpt6wzkmboOeBHslg6R0W2Lggj5f99sTkm5o2E= Date: Tue, 13 Feb 2024 10:41:35 +0100 From: Greg KH To: Charan Teja Kalla Cc: akpm@linux-foundation.org, willy@infradead.org, vbabka@suse.cz, dhowells@redhat.com, david@redhat.com, surenb@google.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, # see patch description Subject: Re: [PATCH] mm/huge_memory: fix swap entry values of tail pages of THP Message-ID: <2024021309-predict-scrubber-d6f3@gregkh> References: <1707814102-22682-1-git-send-email-quic_charante@quicinc.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=us-ascii Content-Disposition: inline In-Reply-To: <1707814102-22682-1-git-send-email-quic_charante@quicinc.com> On Tue, Feb 13, 2024 at 02:18:10PM +0530, Charan Teja Kalla wrote: > An anon THP page is first added to swap cache before reclaiming it. > Initially, each tail page contains the proper swap entry value(stored in > ->private field) which is filled from add_to_swap_cache(). After > migrating the THP page sitting on the swap cache, only the swap entry of > the head page is filled(see folio_migrate_mapping()). > > Now when this page is tried to split(one case is when this page is again > migrated, see migrate_pages()->try_split_thp()), the tail pages > ->private is not stored with proper swap entry values. When this tail > page is now try to be freed, as part of it delete_from_swap_cache() is > called which operates on the wrong swap cache index and eventually > replaces the wrong swap cache index with shadow/NULL value, frees the > page. > > This leads to the state with a swap cache containing the freed page. > This issue can manifest in many forms and the most common thing observed > is the rcu stall during the swapin (see mapping_get_entry()). > > On the recent kernels, this issues is indirectly getting fixed with the > series[1], to be specific[2]. Then why can we not take that series? Taking one-off patches almost ALWAYS causes future problems, what are you going to do to prevent that here (merge and logic problems). > When tried to back port this series, it is observed many merge > conflicts and also seems dependent on many other changes. As backporting > to LTS branches is not a trivial one, the similar change from [2] is > picked as a fix. > > [1] https://lore.kernel.org/all/20230821160849.531668-1-david@redhat.com/ > [2] https://lore.kernel.org/all/20230821160849.531668-5-david@redhat.com/ Again, please try to take the original series, ESPECIALLY for stuff in -mm which is tricky and likely to blow up in odd ways in the future. So I will not take this unless the -mm maintainers agree it really is the only way forward. thanks, greg k-h