Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp5251555iob; Mon, 9 May 2022 12:00:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5kg+XI5hS2cWvVO6ys+i8RtmktJMACiiNvBsrSFNivFVrUptkS3ZFt+xKtMvM9xmn33OW X-Received: by 2002:a05:6a00:4515:b0:510:9ec3:e815 with SMTP id cw21-20020a056a00451500b005109ec3e815mr8353824pfb.65.1652122800242; Mon, 09 May 2022 12:00:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652122800; cv=none; d=google.com; s=arc-20160816; b=iqaf5xbhsOicvTOH/JHJ/GSNinSTgn+eHhExgrB5HZlisGzzY+/QV7BbdnnacoNQho xXfZVFokePWloRAxF7Emp4d/ezE/zREucfSOyTdNHEofOHIteqdICv7iCDhwPY9QZV9s Wam0GJ2yVGjKze6UufNi8Fa5DrOHfINrb984aan5HSgphtU0PVit2lGHLk+JDmemnhw6 xMaCnkv9KdzaMFUk2NJy4iAnZYoVYJTN15hrfz5HUkouUhh+NHKV6Sq4gleKF3Le6k3f liDBJ0/dFU/mwTc3i3orx2g3LgvNqbq7r7wpG40Fz19zAHK6W1Z0o+t8hD90+ydm1CQr wPVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=moFQzzRFi44w44yK6zIWfzr2+7tDojIVJfR+beGUqeU=; b=RKz61Z034PFxry3MCA4Z4U9h7JA2vGu1uJca9dtUYIErK3WygFyvScH2tDPhvH8KqX qCD9NfiDBhHHMqIbR4B9ZuKDpMqG69GiKQu+gd85oi96kzbexeUaJzxhMF/9hupsCM4z F2CuQauy01V4CTRDir0/73PubUQUbP0Ssx4YBLnneXq9FbSDBPi+rYZVHmxTRErq/nQs qqv7LjSyqtlBBrulDg1iVrG6kItrapt3ahZ1ci5FT3DX7xtGY82qBrvogYAE3Ftv/kO1 /PKVGp2OH/AUaMRRHIwydQQWeqFaiN0Ymqof6aY3fathPAquTzn04XNJkWd6dbvwXRMJ LedQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=uLkXC1Me; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id j71-20020a63804a000000b003a9f9442c80si13100009pgd.508.2022.05.09.11.59.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 12:00:00 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=uLkXC1Me; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B67D82734EB; Mon, 9 May 2022 11:55:06 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240329AbiEIS6x (ORCPT + 99 others); Mon, 9 May 2022 14:58:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240323AbiEIS6r (ORCPT ); Mon, 9 May 2022 14:58:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 633AD268EB1 for ; Mon, 9 May 2022 11:54:53 -0700 (PDT) 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 ams.source.kernel.org (Postfix) with ESMTPS id 20DBFB81900 for ; Mon, 9 May 2022 18:54:52 +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-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?