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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6AC6AC433F5 for ; Tue, 8 Feb 2022 08:44:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=d4Z+VzAb4PRmkwnzWObHwUt5slqW1aPGSJiy6y3aUE8=; b=t8UPjQwGf3/Kje /Z75lo0X4fWcTTw1beOvD8/iBH4Bx+ATv+aV3snJ/oBLIcm0fBXDPsNA9EiS/2AjiI222lkX0Tkej uyMS/DjRuSWWP42K2WTTTqKPnv0XloxkM/mz7sUnYhgK5DsWrkT4pPeY06QJyIrZkIPJphmwGyV9q mo4zHqxNWK5BrNW6w1HC3cQMn3SwtX1lH53+hFsMQ58Qg7xxiXwENgDThZ8dExRJMiy1tuA0Gmelk hxJNS5J7naH7erBIangipTnH21qjQ6bM53NrieowzGe5BiCNkE+fCBOzCoPlRaedIL7j4cOEZeNxO mcsGnz4rzVe744P1k/ww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nHM57-00D25i-Mk; Tue, 08 Feb 2022 08:42:37 +0000 Received: from mail-il1-x132.google.com ([2607:f8b0:4864:20::132]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nHM53-00D24L-Um for linux-arm-kernel@lists.infradead.org; Tue, 08 Feb 2022 08:42:35 +0000 Received: by mail-il1-x132.google.com with SMTP id d3so13303519ilr.10 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=K9wiL+urRpsN8Qa6qUfleqoq2SXvdaptixNGWeY0Hc53c/J1xBLtuUb4VbL0iJC1RT 5Iw9T5RSKItMxSRjjqg42qsQdThwTJBg03Hy5NRkxXLsIFxp67S9QrHvgWJWcas+QtEr q32jkdgLrcG/Yx83CrgIf7gnFCfY3ZkmvH/1r1VQt0USEMCgUAFxMLwRo4lXmrXq3XgH 4e+Hn8AbzBQghy/uMPRuOmsbWH7wMrt3glGmX0M4CnlEv0kRDjq1Pt2D1b42DAGy9HAD IoaWlViRAd6fBWUgz8DcAwAam75TfIMQi8YrPXiQkRDN40jK6JXEsX9WSGsJJFuG+wkH H/6g== X-Gm-Message-State: AOAM533VzhPvlIqA6UnJKPtOcFVqDhhEkPNInjMzPhzE4D+T5JmBMSHz Ln7eMQGXNM8tBG6NxbLgGwpuxw== 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-Disposition: inline In-Reply-To: <20220208081902.3550911-10-yuzhao@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220208_004234_020429_282820C3 X-CRM114-Status: GOOD ( 18.75 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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/ _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel