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 00C5FC54798 for ; Tue, 5 Mar 2024 10:44:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 636866B00A3; Tue, 5 Mar 2024 05:44:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5E53E6B00A4; Tue, 5 Mar 2024 05:44:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 484816B00A6; Tue, 5 Mar 2024 05:44:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 34B626B00A3 for ; Tue, 5 Mar 2024 05:44:53 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id F358A160AFC for ; Tue, 5 Mar 2024 10:44:52 +0000 (UTC) X-FDA: 81862652424.11.CFB89F8 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf11.hostedemail.com (Postfix) with ESMTP id 14B1540015 for ; Tue, 5 Mar 2024 10:44:50 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=none; spf=pass (imf11.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709635491; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bQ4FRrYUXq512OVyUmzXE0g69BY4JE8cZqWxK+jiJDQ=; b=W+7b+Iyoqw6JKqq6gR660oV279oYVI/N4/nVy+gynMj3Ie9aL4Tgxk7XMNViO+wRZcXRJ3 S5D+bAF8vc5vvfTOsaJ7YityBW65k7EHXPpxyw/4SLImaM8vB0G96VBsnPrCpyPBi3pl92 3OhvrxHOX27Ko1qEouobzThKfm8MlyU= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=none; spf=pass (imf11.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709635491; a=rsa-sha256; cv=none; b=2LGGe86zdZuSpqZsuLZ0n96G+bAAPA8jBu9fbster3RJWlA3WBLjPi7TkPyvpMwUrK15g5 f2+hBbRiWg35u9z4HIQonDsr34a0GS4tUBnAcTr95nz0MR/JhEYq6vvYJmE1o+sjxqLhq+ tagnau8l3W/Qy0oiyD2dWMqRdnsjASk= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7773D1FB; Tue, 5 Mar 2024 02:45:26 -0800 (PST) Received: from [10.1.39.151] (XHFQ2J9959.cambridge.arm.com [10.1.39.151]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BDD363F762; Tue, 5 Mar 2024 02:44:47 -0800 (PST) Message-ID: <19c2cf15-8789-4977-b149-83b53d2b6abb@arm.com> Date: Tue, 5 Mar 2024 10:44:46 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 4/4] mm: swap: Swap-out small-sized THP without splitting Content-Language: en-GB To: Barry Song <21cnbao@gmail.com> Cc: akpm@linux-foundation.org, david@redhat.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, mhocko@suse.com, shy828301@gmail.com, wangkefeng.wang@huawei.com, willy@infradead.org, xiang@kernel.org, ying.huang@intel.com, yuzhao@google.com, chrisl@kernel.org, surenb@google.com, hanchuanhua@oppo.com References: <20231025144546.577640-5-ryan.roberts@arm.com> <20240205095155.7151-1-v-songbaohua@oppo.com> <7061b9f4-b7aa-4dad-858c-53ee186c2d8f@arm.com> From: Ryan Roberts In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 14B1540015 X-Rspam-User: X-Stat-Signature: aw9ysx9e84r7y3i61czqwjn31f19a5uq X-Rspamd-Server: rspam01 X-HE-Tag: 1709635490-183795 X-HE-Meta: U2FsdGVkX18HuCbVx99EpflHcxwT0KIc6B27Jg3jKOK0rT6/+ky6QQO1X7k0tKZbwALYVUZVO6FfbvkhTAAFMizuRHqW5vu/Rvtmq8NmnlpfP4ljqJ6H2Tlg00KSHvyDOH1KhfUjY1fmuwLURJl7LjaWHe13n0dD6KDBeCq9ZnRNww8g98NfMeDHhwNbG7V/W3CTX0wWvdRkZV30wj4V5sES9I3NXTfJ6zZ+iIsYbLveR8ILTQ26MNY9lKuynmuKYrehWVQXDAcgyg7Yb4UYj8FT6BoOumyEF2MTssWiRtg+hxQSfOzCiu8btk0FZEx96pP69m2YN9sE4lspBz7V2kxQyUyjKVC2h457BFZghpGjJKL82+6SUnwReEGS67xm3J/Y+Pcs9Kk48vLUdUDZPcqpvGtLrlyG/j3J0BncUt/a8lbquAIyw7E9kXIT7cwc+XQUarw7OKN9OnF53PpCkoGoGi6sOqUc3o1UA2iCZ1xHjgIzmJR6RloY/1O6027kxZ6VRt7xZMFplxtjHgs/+WNuxLRDLxYcsBKOdBqJUmhOmVPt1B2MWT1fHDtKLnEFdczNcatnDeDVag4d3FUXOsOYvGOI1pLDdRZQJd7kTLInkl7JV2Th27Ry6arIElDW0YDKsxB+VmkmWwDGvTVWnPVUbhSLv2YKL1X6K/I5s8l2DFnI0G5+wFwdZotffi168x3Pk5UdP/psnFlQPwiD3b7VrU4Xev52MR75DBUylA/uBTJo++TqxF5aR72eiUZ2VxJOWADQhA+DyeovCCvFJUygnoR33+Noz8SOiG83g9CvpHNVnlqERUw7PjgABGCjIX9Y1j/WsKeFC4/HJs8B6MLQUkBuWz39 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 05/03/2024 09:54, Barry Song wrote: > On Tue, Mar 5, 2024 at 10:00 PM Ryan Roberts wrote: >> >> Hi Barry, >> >> On 18/02/2024 23:40, Barry Song wrote: >>> On Tue, Feb 6, 2024 at 1:14 AM Ryan Roberts wrote: >>>> >>>> On 05/02/2024 09:51, Barry Song wrote: >>>>> +Chris, Suren and Chuanhua >>>>> >>>>> Hi Ryan, >> [...] >>>> >>> >>> Hi Ryan, >>> I am running into some races especially while enabling large folio swap-out and >>> swap-in both. some of them, i am still struggling with the detailed >>> timing how they >>> are happening. >>> but the below change can help remove those bugs which cause corrupted data. >> >> I'm getting quite confused with all the emails flying around on this topic. Here >> you were reporting a data corruption bug and your suggested fix below is the one >> you have now posted at [1]. But in the thread at [1] we concluded that it is not >> fixing a functional correctness issue, but is just an optimization in some >> corner cases. So does the corruption issue still manifest? Did you manage to >> root cause it? Is it a problem with my swap-out series or your swap-in series, >> or pre-existing? > > Hi Ryan, > > It is not a problem of your swap-out series, but a problem of my swap-in > series. The bug in swap-in series is triggered by the skipped PTEs in the > thread[1], but my swap-in code should still be able to cope with this situation > and survive it - a large folio might be partially but not completely unmapped > after try_to_unmap_one(). Ahh, understood, thanks! > I actually replied to you and explained all > the details here[2], but guess you missed it :-) I did read that mail, but the first line "They are the same" made me think this was solving a functional problem. And I still have a very shaky understanding of parts of the code that I haven't directly worked on, so sometimes some of the details go over my head - I'll get there eventually! > > [1] https://lore.kernel.org/linux-mm/20240304103757.235352-1-21cnbao@gmail.com/ > [2] https://lore.kernel.org/linux-mm/CAGsJ_4zdh5kOG7QP4UDaE-wmLFiTEJC2PX-_LxtOj=QrZSvkCA@mail.gmail.com/ > > apology this makes you confused. No need to apologise - I appreciate your taking the time to write it all down in detail. It helps me to learn these areas of the code. > >> >> [1] https://lore.kernel.org/linux-mm/20240304103757.235352-1-21cnbao@gmail.com/ >> >> Thanks, >> Ryan >> > > Thanks > Barry