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 6642AC48260 for ; Tue, 13 Feb 2024 09:41:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D8D478D000E; Tue, 13 Feb 2024 04:41:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D3D928D0001; Tue, 13 Feb 2024 04:41:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C2CEF8D000E; Tue, 13 Feb 2024 04:41:46 -0500 (EST) 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 B46148D0001 for ; Tue, 13 Feb 2024 04:41:46 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 8213B140A84 for ; Tue, 13 Feb 2024 09:41:46 +0000 (UTC) X-FDA: 81786288612.07.75F837A Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf28.hostedemail.com (Postfix) with ESMTP id 77CF5C0010 for ; Tue, 13 Feb 2024 09:41:43 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=korg header.b=t3BLbJLW; dmarc=pass (policy=none) header.from=linuxfoundation.org; spf=pass (imf28.hostedemail.com: domain of gregkh@linuxfoundation.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1707817304; 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=gHneSwnoLJP21DdMKu2j3JRhkY5arjY1CfMn1GYw+KY=; b=Y6DzTzvQCx0cSluqz/B1FnqAOcS6mB+7U8bkgv2/dJ+4I+e6gFSzOlEx0bR7gcQloULRrp oUyEamVwHILarqVxpmxJUtt5xkN+JaZGB2ka81HU8Jdpi1IglU8BsVjKHJQz7VL62PcUGU djlUrS0WAOzQzA4arBJfZdJNlur7F9Q= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=korg header.b=t3BLbJLW; dmarc=pass (policy=none) header.from=linuxfoundation.org; spf=pass (imf28.hostedemail.com: domain of gregkh@linuxfoundation.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707817304; a=rsa-sha256; cv=none; b=P2lY8nuw/U6gl0sYNIS4K09uyx4+D+LiaYN1luttOX7z5RFs4KUi9evJk8vkXQwAxiYU9Z TeUejC73ZkyjdNTCudFBZPtYqF5OZ8UMeXy6bqopmQW0ecBfBWXCg2OZivbVn30wJHpYy8 5uUfyyppTriPjbyQYoh+HhTyO0p8Ydw= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 5D7B4CE1A8F; Tue, 13 Feb 2024 09:41:39 +0000 (UTC) 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> 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> X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 77CF5C0010 X-Stat-Signature: fgbiedo6kfu31cbw6fukcofj3idyfieo X-HE-Tag: 1707817303-461475 X-HE-Meta: U2FsdGVkX1/A1hIeDC/y1gP28CNFJbMs3LWfu/ogh4kaWL6GDY+zG5ET0NquX7kVUOjyoE1Mr42KDIgeeqHPCvDoS8kEAScZUGQk7OuvuvWdmcm1a8toN4NMwpihYZuz6G6YEXpSH6mP/jAPj5OtYjTWA7GO2de8fkkytPdiWHwjHVRY1ObvOtYeaLDuJSJa0jd1LOguhTn81Glqx/RaRlYlvVbX8Ol+YaciIH7j0WkdBMDPDPsfXCxWEPogNiRVKNEEGCzBCSYUgnFW+OgrVRkHqKxWnPAD2Qj8/fPxx0CFC0QFVhUmLhlz7I8uHJHxBsWSLZy+ZskVt+Q3Sfh9bvyD+CAkEDwU/oDmbFNx1ujf7LVep1qKhKnCzbeB567JB0BTBNDwoRRxeYXjn2SuzezXhZ9h7rr4DXykg3RkDhBW7PnF0OvEakJPd7FvA8Nl3DU548Dj2iUdKPsVHdmtzcinkmml8+pq3zLhC9OyHHoKIrgRu2VjUIQJlui4xyKBA/b204DR+yV+uLfAb4VohEmResXAzQvaQpLRxVjrXfP9tShiVpwRSrhqfAHhmB5YrszI4T53bF8WnZfzZCzVAcJTVbM6Ftk6k3XAaMlUjoPZCyqtddcjEIQtymI5wZTuggEJA7YR+fWkncCtriFmEKrYpC8n6fEpMT3M+7kUn89fxe6kKihwlfequUUudAP83SNsTmoR/O/Ungo15hDVVXRMyA0HvHwlXMAwQ+BUallvKY2aH3n5OY+aheCjf2zxcxspZzVIaGh1zKMXJIy434XRj8sFW3uhbUmhrQO3g4hQ/frcQ1FvJ4fs1Yc5ZWIrEZdCRejUr8UbFamIA9qneX0EHhvqN/YkpQ2bMvR9IYaooav2ZudydDkDEN+gNRBXM4ZqBWJAz2PmhSBUp3qfl3kFOUX0xB1fuQlfDR90Um1e9dRK5jnJ3ef59eG9nucLSIARt6hnZDQEEQtu7sN 8CA== 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: List-Subscribe: List-Unsubscribe: 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