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 7389CC433EF for ; Mon, 9 May 2022 18:54:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 055E56B007D; Mon, 9 May 2022 14:54:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 005786B007E; Mon, 9 May 2022 14:54:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E36486B0080; Mon, 9 May 2022 14:54:52 -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 D56F16B007D for ; Mon, 9 May 2022 14:54:52 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 9E2BB21251 for ; Mon, 9 May 2022 18:54:52 +0000 (UTC) X-FDA: 79447106424.21.D087E7E Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf09.hostedemail.com (Postfix) with ESMTP id BC99914008E for ; Mon, 9 May 2022 18:54:44 +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 dfw.source.kernel.org (Postfix) with ESMTPS id 664166118F; Mon, 9 May 2022 18:54:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A61CC385B6; Mon, 9 May 2022 18:54:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1652122490; bh=nP4AaDAQvx8ByC615kFCUYPzsO+pDHdHQ+SVWEedQEY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=uLkXC1Me95pG+Iu0knA05AobpRJGOiDwU/ZRC0txVD7BJ5rG/3n9aYr1DfuRQL+Tx VJT9NYKhAQVK94aMTEZyxkJUayJaIIBw4BVZN0BQC3MJea4f/Tz9bgiMR9T8Pxz8ZB DXFn0GNnrMxuT5WUmlGoElbSjDNlPY967X7Dm9Gk= Date: Mon, 9 May 2022 11:54:49 -0700 From: Andrew Morton To: Minchan Kim Cc: LKML , linux-mm , Suren Baghdasaryan , Michal Hocko , John Dias , Tim Murray , Matthew Wilcox , Vladimir Davydov Subject: Re: [PATCH v2] mm: don't be stuck to rmap lock on reclaim path Message-Id: <20220509115449.f48559dd40a5e5ec95b8ead8@linux-foundation.org> In-Reply-To: <20220509154710.4132957-1-minchan@kernel.org> References: <20220509154710.4132957-1-minchan@kernel.org> 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 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: BC99914008E X-Stat-Signature: m531mp6s76qr55t3fxgx1o54ynidun3m X-Rspam-User: Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=uLkXC1Me; spf=pass (imf09.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-HE-Tag: 1652122484-695300 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 Mon, 9 May 2022 08:47:10 -0700 Minchan Kim wrote: > The rmap locks(i_mmap_rwsem and anon_vma->root->rwsem) could be > contented under memory pressure if processes keep working on > their vmas(e.g., fork, mmap, munmap). It makes reclaim path > stuck. In our real workload traces, we see kswapd is waiting the > lock for 300ms+(a sec as worst case) and it makes other processes > entering direct reclaim, which were also stuck on the lock. > > This patch makes LRU aging path try_lock mode like shink_page_list > so the reclaim context will keep working with next LRU pages > without being stuck. > > Since this patch introduces a new "contended" field as out-param > along with try_lock in-param in rmap_walk_control, it's not > immutable any longer if the try_lock is set so remove const > keywords on rmap related functions. Since rmap walking is already > expensive operation, I doubt the const would help sizable benefit( > And we didn't have it until 5.17). Some quantitative testing results would be helpful. Demonstrate the benefits of the patch?