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 F0087C433EF for ; Tue, 8 Feb 2022 08:42:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8C4A96B0083; Tue, 8 Feb 2022 03:42:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8750D6B0085; Tue, 8 Feb 2022 03:42:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 73D746B0087; Tue, 8 Feb 2022 03:42:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0001.hostedemail.com [216.40.44.1]) by kanga.kvack.org (Postfix) with ESMTP id 66ACD6B0083 for ; Tue, 8 Feb 2022 03:42:34 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 2A0A3181F24A4 for ; Tue, 8 Feb 2022 08:42:34 +0000 (UTC) X-FDA: 79118971428.16.48F3D7E Received: from mail-il1-f172.google.com (mail-il1-f172.google.com [209.85.166.172]) by imf15.hostedemail.com (Postfix) with ESMTP id C5BB6A0006 for ; Tue, 8 Feb 2022 08:42:33 +0000 (UTC) Received: by mail-il1-f172.google.com with SMTP id z18so13342517ilp.3 for ; Tue, 08 Feb 2022 00:42:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=FhfpJki+NNdkV0gRVxsiFBe0vxe4of82upgxXPZeRnU=; b=ltrv7fjxH8Z/MYJ+dFqSX07UsjFk0En2JVojwb07khT6GU/nljRY6ZcUw5XDkY2k9U 10iCVy9Ac2BAJDuQFYo9S7tDIj3P9JKeZpva3KedKVwTgq/++kCs4tuecqGhtM8RyvXv mvjO6MjUYOeh3Eb7IF2GiKoupddeqo33NlX0dsBG/idvvizpFhLyoF6+Ck2Qi07i8O9m kuh39mSjp36sDeaM7WmQrV59O+OXMvNNFEcQADvyZ5Sp4fcVXuPGhcMOghBHacSXUKXf Zz7AOL9oylZsRdYSmJE8C0LTQ9L/alT7qztTD5bsEs2FMyshCXc9x3zGHrUcOn2yuILW p8Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=FhfpJki+NNdkV0gRVxsiFBe0vxe4of82upgxXPZeRnU=; b=yJJvBu0OrfacHS8oqgpZf1wl0FrX71gkpx/bpfitZZnmQNPpVVXV9DYWDMJJK6Se7R VeoZ7wPBlQ5ynWCmHsjG3yJ96HRCnosVh7sLgwywyQHxxy7VIqv01lMadWncD0VJnmMi 56TjwDMfihJpten6lI3DZfWZgozYENpS4jQ8Ub6cNp4KhouZcOOZSJQXBlUd6kXmhH3n euX/J5sYfxw4MLvKJxUrEmHhlhNfRy02uoZ1ooQeEJ4uXwyxAEwfX9y4YZ7CfXC7e++H oXpL4jzTisTIIjGb78g5PZeNT9ZGeA6TgDem/D9T1lIAdL4W0AT5SPXKIvkcG9WORbNs mkXA== X-Gm-Message-State: AOAM530iTMEWKa13OGxz0nfEfZ5wfjQMLZQg//9XZrso07FN61gQFcE1 UVqqRjS6ntxVDseHTlAN+9fGGw== X-Google-Smtp-Source: ABdhPJyYhd/AJxeDgLSOW7+qrTADVxq90CiyDTRHsiwwvVnqVHQOfXMPMVg1u68HTRArEl9IZnGDZQ== X-Received: by 2002:a05:6e02:144c:: with SMTP id p12mr1713786ilo.182.1644309753034; Tue, 08 Feb 2022 00:42:33 -0800 (PST) Received: from google.com ([2620:15c:183:200:5f31:19c3:21f5:7300]) by smtp.gmail.com with ESMTPSA id r9sm7575223ill.52.2022.02.08.00.42.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Feb 2022 00:42:32 -0800 (PST) Date: Tue, 8 Feb 2022 01:42:28 -0700 From: Yu Zhao To: Andrew Morton , Johannes Weiner , Mel Gorman , Michal Hocko Cc: Andi Kleen , Aneesh Kumar , Barry Song <21cnbao@gmail.com>, Catalin Marinas , Dave Hansen , Hillf Danton , Jens Axboe , Jesse Barnes , Jonathan Corbet , Linus Torvalds , Matthew Wilcox , Michael Larabel , Mike Rapoport , Rik van Riel , Vlastimil Babka , Will Deacon , Ying Huang , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, page-reclaim@google.com, x86@kernel.org, Brian Geffon , Jan Alexander Steffens , Oleksandr Natalenko , Steven Barrett , Suleiman Souhlal , Daniel Byrne , Donald Carr , Holger =?iso-8859-1?Q?Hoffst=E4tte?= , Konstantin Kharlamov , Shuang Zhai , Sofia Trinh Subject: Re: [PATCH v7 09/12] mm: multigenerational LRU: runtime switch Message-ID: References: <20220208081902.3550911-1-yuzhao@google.com> <20220208081902.3550911-10-yuzhao@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220208081902.3550911-10-yuzhao@google.com> Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=ltrv7fjx; spf=pass (imf15.hostedemail.com: domain of yuzhao@google.com designates 209.85.166.172 as permitted sender) smtp.mailfrom=yuzhao@google.com; dmarc=pass (policy=reject) header.from=google.com X-Stat-Signature: aonezswwo8hfei5waohgr99ay8e9oo4c X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: C5BB6A0006 X-Rspam-User: X-HE-Tag: 1644309753-806847 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 Tue, Feb 08, 2022 at 01:18:59AM -0700, Yu Zhao wrote: > Add /sys/kernel/mm/lru_gen/enabled as a runtime switch. Features that > can be enabled or disabled include: > 0x0001: the multigenerational LRU > 0x0002: the page table walks, when arch_has_hw_pte_young() returns > true > 0x0004: the use of the accessed bit in non-leaf PMD entries, when > CONFIG_ARCH_HAS_NONLEAF_PMD_YOUNG=y > [yYnN]: apply to all the features above > E.g., > echo y >/sys/kernel/mm/lru_gen/enabled > cat /sys/kernel/mm/lru_gen/enabled > 0x0007 > echo 5 >/sys/kernel/mm/lru_gen/enabled > cat /sys/kernel/mm/lru_gen/enabled > 0x0005 > > NB: the page table walks happen on the scale of seconds under heavy > memory pressure. Under such a condition, the mmap_lock contention is a > lesser concern, compared with the LRU lock contention and the I/O > congestion. So far the only well-known case of the mmap_lock > contention is Android, due to Scudo [1] which allocates several > thousand VMAs for merely a few hundred MBs. The SPF and the Maple Tree > also have provided their own assessments [2][3]. However, if the page > table walks do worsen the mmap_lock contention, the runtime switch can > be used to disable this feature. In this case the multigenerational > LRU will suffer a minor performance degradation, as shown previously. Clarified the potential impact from the mmap_lock contention as requested here: https://lore.kernel.org/linux-mm/YdwQcl6D5Mbp9Z4h@dhcp22.suse.cz/ > +static void lru_gen_change_state(bool enable) > +{ > + static DEFINE_MUTEX(state_mutex); > + > + struct mem_cgroup *memcg; > + > + cgroup_lock(); > + cpus_read_lock(); > + get_online_mems(); > + mutex_lock(&state_mutex); > + > + if (enable == lru_gen_enabled()) > + goto unlock; > + > + if (enable) > + static_branch_enable_cpuslocked(&lru_gen_caps[LRU_GEN_CORE]); > + else > + static_branch_disable_cpuslocked(&lru_gen_caps[LRU_GEN_CORE]); Fixed the lockdep warning for memory hotplug: https://lore.kernel.org/linux-mm/87a6g0nczg.fsf@linux.ibm.com/