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 BE021ECAAD3 for ; Sun, 11 Sep 2022 23:48:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 075EB8D0003; Sun, 11 Sep 2022 19:48:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 024F18D0001; Sun, 11 Sep 2022 19:48:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E2EE78D0003; Sun, 11 Sep 2022 19:48:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id D14388D0001 for ; Sun, 11 Sep 2022 19:48:32 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 9EE6F80632 for ; Sun, 11 Sep 2022 23:48:32 +0000 (UTC) X-FDA: 79901446464.17.6939EBC Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf28.hostedemail.com (Postfix) with ESMTP id 36174C00B8 for ; Sun, 11 Sep 2022 23:48:32 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B5F7AB80B54; Sun, 11 Sep 2022 23:48:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D86AEC433D7; Sun, 11 Sep 2022 23:48:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1662940109; bh=t1jgc4Li5g5fFW9NerbgXBzTYKrrbratV/fa4ALxfKI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=PIYZsDKxH4Ep23P3oVAYMUotd5atx/hz5oIf3Z8IPjig/sfH/+rDeZecDiosrGHFI op/fl3o/nDe8expDY80ZXg9v9Qw8HjDQc2gbAw9O+NfLd3M30utB3CFcXV5M7KUARE JiV5PiCHjNONQuruacdsC61++ydwVQ5g8WOjLqEw= Date: Sun, 11 Sep 2022 16:48:28 -0700 From: Andrew Morton To: Peter Xu Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Hugh Dickins , "Kirill A . Shutemov" , Alistair Popple , Andrea Arcangeli , Minchan Kim , David Hildenbrand , Andi Kleen , Nadav Amit , Huang Ying , Vlastimil Babka Subject: Re: [PATCH v4 5/7] mm: Remember young/dirty bit for page migrations Message-Id: <20220911164828.faaa229189826ef2c219fc2d@linux-foundation.org> In-Reply-To: <20220811161331.37055-6-peterx@redhat.com> References: <20220811161331.37055-1-peterx@redhat.com> <20220811161331.37055-6-peterx@redhat.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662940112; a=rsa-sha256; cv=none; b=f3kRE8ot933k0kKgudzun+kBb5ft3jy4gpAz8gZjau+l6V9Id+XB3uC90AePd5gfzgr6E2 9KY177rk2nFVqo3krtTpLPXlB/EebRkJfVoIGCjvmEIc9wvcJIclFx0NxzPLcww9h6ZcVZ j8m4WMnIMQg4wLLd6fpz9Grw6OZpEdk= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=PIYZsDKx; dmarc=none; spf=pass (imf28.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662940112; 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:dkim-signature; bh=FjvzSWy1cHCHhdBIy2aP6BJ8hZi7+Yx9vh7Nm+MYuN8=; b=Athfk9ImqA/MxmCEhW/8CdVWlq2k9PKZkJx0M0Bh/olbhGeJ6lABFvYHM2dA6i6QQW3eaK M6EVacd95hHFwBdg6Z30ggZf/ImvSSVUCWIBZrYigJKOTdcMGLk3Fyd86egGnOdVp3SKVp EWJ2Doe5W95fv3hhqk8frO3RygRsNPw= Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=PIYZsDKx; dmarc=none; spf=pass (imf28.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Rspam-User: X-Rspamd-Server: rspam10 X-Stat-Signature: cetnuxkudksgjgkpu4pn9o5zkg9wwqag X-Rspamd-Queue-Id: 36174C00B8 X-HE-Tag: 1662940112-52197 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: On Thu, 11 Aug 2022 12:13:29 -0400 Peter Xu wrote: > When page migration happens, we always ignore the young/dirty bit settings > in the old pgtable, and marking the page as old in the new page table using > either pte_mkold() or pmd_mkold(), and keeping the pte clean. > > That's fine from functional-wise, but that's not friendly to page reclaim > because the moving page can be actively accessed within the procedure. Not > to mention hardware setting the young bit can bring quite some overhead on > some systems, e.g. x86_64 needs a few hundreds nanoseconds to set the bit. > The same slowdown problem to dirty bits when the memory is first written > after page migration happened. > > Actually we can easily remember the A/D bit configuration and recover the > information after the page is migrated. To achieve it, define a new set of > bits in the migration swap offset field to cache the A/D bits for old pte. > Then when removing/recovering the migration entry, we can recover the A/D > bits even if the page changed. > > One thing to mention is that here we used max_swapfile_size() to detect how > many swp offset bits we have, and we'll only enable this feature if we know > the swp offset is big enough to store both the PFN value and the A/D bits. > Otherwise the A/D bits are dropped like before. > There was some discussion over v3 of this patch, but none over v4. Can people please review this patch series so we can get moving with it? Thanks.