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 9004CECAAA1 for ; Tue, 13 Sep 2022 00:55:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DF67F8D0001; Mon, 12 Sep 2022 20:55:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DA3BB6B0073; Mon, 12 Sep 2022 20:55:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C6AC08D0001; Mon, 12 Sep 2022 20:55:52 -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 B70A66B0072 for ; Mon, 12 Sep 2022 20:55:52 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 8DF461A0815 for ; Tue, 13 Sep 2022 00:55:52 +0000 (UTC) X-FDA: 79905244944.05.1E634D1 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by imf24.hostedemail.com (Postfix) with ESMTP id 921D01800BE for ; Tue, 13 Sep 2022 00:55:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663030551; x=1694566551; h=from:to:cc:subject:references:date:in-reply-to: message-id:mime-version; bh=dCM6TZmUcoYUCnUYQadHcfqnI3uM9Wcqb/0Hp7avu/c=; b=ZdjeZrv9rYF+OX72vsjulOuFAMBYyXvqT69HO+Hy4VnkoSWYdEmDh4ri D43Ts6an2EWZW/tR+EB/VcI3arwQx09Eh9g9G4Z5yxCCzxkS4kre6t3Vn x9iXwivH+IpJsrziGhM6Q6lUdW+QHyYoYrrd8pbOfXMobkEPhFbn3t9ha wguQ5GWMThatxQISeZIL/lKygF2DoirYrDhvBFlL2bK8e5henRXpo67fZ lJ7oRd0pWVmkCHrIIlYPB2eMlYns64fbJNSj3R5gcic9hmEdmgswn0bXL C1N5H37P9aC/aEI9dL9IARQdqKaGBUvtrUfeQXHRopWjDvmcBhe0jhcFg Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10468"; a="278398907" X-IronPort-AV: E=Sophos;i="5.93,311,1654585200"; d="scan'208";a="278398907" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Sep 2022 17:55:49 -0700 X-IronPort-AV: E=Sophos;i="5.93,311,1654585200"; d="scan'208";a="944848473" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.238.208.55]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Sep 2022 17:55:46 -0700 From: "Huang, Ying" To: Andrew Morton Cc: Peter Xu , 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 , Vlastimil Babka Subject: Re: [PATCH v4 5/7] mm: Remember young/dirty bit for page migrations References: <20220811161331.37055-1-peterx@redhat.com> <20220811161331.37055-6-peterx@redhat.com> <20220911164828.faaa229189826ef2c219fc2d@linux-foundation.org> Date: Tue, 13 Sep 2022 08:55:35 +0800 In-Reply-To: <20220911164828.faaa229189826ef2c219fc2d@linux-foundation.org> (Andrew Morton's message of "Sun, 11 Sep 2022 16:48:28 -0700") Message-ID: <874jxcrt2w.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663030552; a=rsa-sha256; cv=none; b=jri/uCAE94gjO/OSy44fkdaQcU1mNZXIcItbmTIroePrB/8D2lV71Ih/3K/KcQYolXMdq7 6E3XCMlGiX3O70v6qgjDK4PtGR0CrbE8jAPwGbA6H6wJv03Gk+iSReEzc+5POq2t0NZu42 HfF5SIf4SnvIeJ9Sv1dMO5CZCd308eE= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=ZdjeZrv9; spf=pass (imf24.hostedemail.com: domain of ying.huang@intel.com designates 192.55.52.151 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663030552; 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=RxrFwX0t8Sf7PTe5163jKW4lj3n5RPBtrjH4cfobM0U=; b=xV8CQs8meMk4u76avmJOtQ2q4U1HuEL9fY3l321IuGXW0c/XaRDkU0dAArUFSpikqMRLYv p1+UNkxh08jfwVhXi8307D6wcPpAED9wlagIFe/t4Hvo+ba2jjhSCybIXCx2HSRwtU4TQf bVwxyaL9U6qeeOUJU1b2nNUghj8qXQE= X-Rspamd-Queue-Id: 921D01800BE Authentication-Results: imf24.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=ZdjeZrv9; spf=pass (imf24.hostedemail.com: domain of ying.huang@intel.com designates 192.55.52.151 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com X-Rspam-User: X-Rspamd-Server: rspam10 X-Stat-Signature: d7gcyd5t8w41z5bchrs97na51bs4uuk1 X-HE-Tag: 1663030551-623121 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: Andrew Morton writes: > 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? Most discussions over v3 are for migrate_device.c code. There are some bugs and they have been fixed by Alistair via [1]. This patch itself is good. Sorry for bothering. Reviewed-by: "Huang, Ying" [1] https://lore.kernel.org/linux-mm/9f801e9d8d830408f2ca27821f606e09aa856899.1662078528.git-series.apopple@nvidia.com/ Best Regards, Huang, Ying