From patchwork Tue Jun 14 08:16:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Huang, Ying" X-Patchwork-Id: 12880645 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 DE5DBC433EF for ; Tue, 14 Jun 2022 08:17:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3770A8D022A; Tue, 14 Jun 2022 04:17:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 326F48D0229; Tue, 14 Jun 2022 04:17:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1EF768D022A; Tue, 14 Jun 2022 04:17:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 102D78D0229 for ; Tue, 14 Jun 2022 04:17:12 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id C42132153D for ; Tue, 14 Jun 2022 08:17:11 +0000 (UTC) X-FDA: 79576136262.25.5FE67E6 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by imf31.hostedemail.com (Postfix) with ESMTP id 7D0A8200CF for ; Tue, 14 Jun 2022 08:17:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655194630; x=1686730630; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=OrVbnJdhn7FtUc03iOArEa+ZxjCDWhYe5bfK90Mzuxg=; b=a2vH3IgZDu480Db5FqinzG6PoerPItsqQ9SkprkIISC31de+leTSCBKY QlW/sIwAxs46xF7JfmG2GhrlkPDQfcFJV6cBCQIQ/QlhuGdgDwcs0P/lh 9ag6G2/am+TiSH2HzWtrqD6UNfKgzdghzgciIswvLYiEV86XRt+2vhSD7 dkKp+G9BA4r4lwDQ0XpLpIzhSctdhxU1X9UfpyKdfbN7GsC6eFbOW1it6 eGWJMg0Ly8snZDICBh6YMgm2awGIOhXJWKsGy0E3N21WMYU0nen2HBBiH qBIE8Wa21O2Z7505+szHaB1cKffJl67vqhKUVm49sGTimmixXGsaCRPhA Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10377"; a="303954666" X-IronPort-AV: E=Sophos;i="5.91,299,1647327600"; d="scan'208";a="303954666" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2022 01:17:09 -0700 X-IronPort-AV: E=Sophos;i="5.91,299,1647327600"; d="scan'208";a="830274859" Received: from unknown (HELO yhuang6-mobl1.ccr.corp.intel.com) ([10.254.215.153]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2022 01:17:05 -0700 From: Huang Ying To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Huang Ying , Johannes Weiner , Michal Hocko , Rik van Riel , Mel Gorman , Peter Zijlstra , Dave Hansen , Yang Shi , Zi Yan , Wei Xu , osalvador , Shakeel Butt , Zhong Jiang Subject: [PATCH -V3 0/3] memory tiering: hot page selection Date: Tue, 14 Jun 2022 16:16:32 +0800 Message-Id: <20220614081635.194014-1-ying.huang@intel.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655194631; 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-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=TO62CgA0YKV06fakGpXtMhlzQrgY9/8aTN8iSGBw1tE=; b=QuxBGUpxbsxJK5gjo0wytX9n5aGMLZMkIh4gW49LawTcFDfJ808giGt8RGZMqTeYDd2qkK o8coBP4+ZqskKOLIugKORqZesgNA0uu67ISa+raq/nR7DPvKPDxYaBkdTBoX2k4xzf4UMi 88wIClk7MpywaX1jKdmWzsAlxpPmi6E= ARC-Authentication-Results: i=1; imf31.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=a2vH3IgZ; dmarc=pass (policy=none) header.from=intel.com; spf=none (imf31.hostedemail.com: domain of ying.huang@intel.com has no SPF policy when checking 192.55.52.88) smtp.mailfrom=ying.huang@intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655194631; a=rsa-sha256; cv=none; b=mnyMMGZZVf2zaE/rM+JQ1DHg1nX+qB35e3aeC073sa2/7AWBBOskGiLlkjbRZfwwMkm1YK Pd3iMhKbAHpRlBfxfhjDChscpwLzOqdpyRrCZtYDGgBtVlbzhUOq/qI13A7BPtgltN13jc D0pANaRSop7q4ZpRQNy6BiNj8ziAfO0= X-Stat-Signature: 56ujewgo5td35zrks9syge4ny4hgdago X-Rspamd-Queue-Id: 7D0A8200CF X-Rspam-User: X-Rspamd-Server: rspam05 Authentication-Results: imf31.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=a2vH3IgZ; dmarc=pass (policy=none) header.from=intel.com; spf=none (imf31.hostedemail.com: domain of ying.huang@intel.com has no SPF policy when checking 192.55.52.88) smtp.mailfrom=ying.huang@intel.com X-HE-Tag: 1655194630-770714 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: To optimize page placement in a memory tiering system with NUMA balancing, the hot pages in the slow memory nodes need to be identified. Essentially, the original NUMA balancing implementation selects the mostly recently accessed (MRU) pages to promote. But this isn't a perfect algorithm to identify the hot pages. Because the pages with quite low access frequency may be accessed eventually given the NUMA balancing page table scanning period could be quite long (e.g. 60 seconds). So in this patchset, we implement a new hot page identification algorithm based on the latency between NUMA balancing page table scanning and hint page fault. Which is a kind of mostly frequently accessed (MFU) algorithm. In NUMA balancing memory tiering mode, if there are hot pages in slow memory node and cold pages in fast memory node, we need to promote/demote hot/cold pages between the fast and cold memory nodes. A choice is to promote/demote as fast as possible. But the CPU cycles and memory bandwidth consumed by the high promoting/demoting throughput will hurt the latency of some workload because of accessing inflating and slow memory bandwidth contention. A way to resolve this issue is to restrict the max promoting/demoting throughput. It will take longer to finish the promoting/demoting. But the workload latency will be better. This is implemented in this patchset as the page promotion rate limit mechanism. The promotion hot threshold is workload and system configuration dependent. So in this patchset, a method to adjust the hot threshold automatically is implemented. The basic idea is to control the number of the candidate promotion pages to match the promotion rate limit. We used the pmbench memory accessing benchmark tested the patchset on a 2-socket server system with DRAM and PMEM installed. The test results are as follows, pmbench score promote rate (accesses/s) MB/s ------------- ------------ base 146887704.1 725.6 hot selection 165695601.2 544.0 rate limit 162814569.8 165.2 auto adjustment 170495294.0 136.9 From the results above, With hot page selection patch [1/3], the pmbench score increases about 12.8%, and promote rate (overhead) decreases about 25.0%, compared with base kernel. With rate limit patch [2/3], pmbench score decreases about 1.7%, and promote rate decreases about 69.6%, compared with hot page selection patch. With threshold auto adjustment patch [3/3], pmbench score increases about 4.7%, and promote rate decrease about 17.1%, compared with rate limit patch. Changelogs: v3: - Rebased on v5.19-rc1 - Renamed newly-added fields in struct pglist_data. v2: - Added ABI document for promote rate limit per Andrew's comments. Thanks! - Added function comments when necessary per Andrew's comments. - Address other comments from Andrew Morton. Best Regards, Huang, Ying Reviewed-by: Baolin Wang Tested-by: Baolin Wang