Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1024907ybz; Thu, 16 Apr 2020 01:07:12 -0700 (PDT) X-Google-Smtp-Source: APiQypI8FviFoAdjri8JLGmM0JblTRZKEK/sFpvYwA/cJkrETz093BUklFy82IJouGyycx3CgpCH X-Received: by 2002:a17:906:7d7:: with SMTP id m23mr8269574ejc.154.1587024431979; Thu, 16 Apr 2020 01:07:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587024431; cv=none; d=google.com; s=arc-20160816; b=wtsh04+h4wOlMVKQlEy+duEEXth9DLVFsu/k4/oyQ+OCeLNp7RCJCq3kOt28K9eejQ Rrq5s5k1TSVCZl+d837gUDB5GwxNbRSGQwuRCqsN/3oJ8AFFgoEsq0/WPA/7YvrDwzTH YCccqmwWzf3WwnMSB6w9KoRQvCSsGdKfiBmI6wgADx3nqcARF9m/oO0qcVHxnYn64h08 r7s/eOqFz1FhRTftsAZUa5BHkNH8L6phCmM/j7wNiEgp+WQK/Ziw6dFakWifGuTHXFnG fVGD6rs/5syjBc6nOnM1h2ADRSwAIgyY33pB0pcdorquXLTcbPlreltx+VE2CW236AGb IKwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:references:cc:to:from :subject; bh=3WqKCmK09ayNqus51Ji3Q6TB+xRKnRu1acUNNxnatP0=; b=DYAu6UHkGpB96CpfnyUd54HuntmwgKas8GF9FZtQjBHPNTAxcKAWbGORhTXjZjCqRA 9hNsN1MDeP3JWrjKwD/5cAuh6FQuxbpq2dqT3VtOh8sOMaaA154mDT/U/5PskotYMcBS xPNUX8kFuaspLUJSpe+8n13lCT/QSya2hsVHpZOX5SU6UNZp3Mh89HPId0aPVLu+uI/c Td4fXbzgqHChqkdAyCWuKjj/dofu0a+k/H7qVVqVzN/YYQUGvVl+iYWIs/iNpixhosVz Z6WORPfKe3SchZYFvNjHLHaTULw/y0YP6HWH/7JAE2QWjiYWvFINWyYzYR+0y14lkxfE uWuw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lw9si2248618ejb.175.2020.04.16.01.06.47; Thu, 16 Apr 2020 01:07:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2440021AbgDPIDO (ORCPT + 99 others); Thu, 16 Apr 2020 04:03:14 -0400 Received: from out30-130.freemail.mail.aliyun.com ([115.124.30.130]:32793 "EHLO out30-130.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2439971AbgDPICR (ORCPT ); Thu, 16 Apr 2020 04:02:17 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R271e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07488;MF=alex.shi@linux.alibaba.com;NM=1;PH=DS;RN=39;SR=0;TI=SMTPD_---0TvgXXNk_1587024122; Received: from IT-FVFX43SYHV2H.local(mailfrom:alex.shi@linux.alibaba.com fp:SMTPD_---0TvgXXNk_1587024122) by smtp.aliyun-inc.com(127.0.0.1); Thu, 16 Apr 2020 16:02:03 +0800 Subject: Re: [PATCH v8 03/10] mm/lru: replace pgdat lru_lock with lruvec lock From: Alex Shi To: Johannes Weiner , akpm@linux-foundation.org Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, mgorman@techsingularity.net, tj@kernel.org, hughd@google.com, khlebnikov@yandex-team.ru, daniel.m.jordan@oracle.com, yang.shi@linux.alibaba.com, willy@infradead.org, shakeelb@google.com, Michal Hocko , Vladimir Davydov , Roman Gushchin , Chris Down , Thomas Gleixner , Vlastimil Babka , Qian Cai , Andrey Ryabinin , "Kirill A. Shutemov" , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Andrea Arcangeli , David Rientjes , "Aneesh Kumar K.V" , swkhack , "Potyra, Stefan" , Mike Rapoport , Stephen Rothwell , Colin Ian King , Jason Gunthorpe , Mauro Carvalho Chehab , Peng Fan , Nikolay Borisov , Ira Weiny , Kirill Tkhai , Yafang Shao , Wei Yang References: <1579143909-156105-1-git-send-email-alex.shi@linux.alibaba.com> <1579143909-156105-4-git-send-email-alex.shi@linux.alibaba.com> <20200116215222.GA64230@cmpxchg.org> <20200413180725.GA99267@cmpxchg.org> <8e7bf170-2bb5-f862-c12b-809f7f7d96cb@linux.alibaba.com> <20200414163114.GA136578@cmpxchg.org> <54af0662-cbb4-88c7-7eae-f969684025dd@linux.alibaba.com> Message-ID: <0bed9f1a-400d-d9a9-aeb4-de1dd9ccbb45@linux.alibaba.com> Date: Thu, 16 Apr 2020 16:01:20 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <54af0662-cbb4-88c7-7eae-f969684025dd@linux.alibaba.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2020/4/15 下午9:42, Alex Shi 写道: > Hi Johannes, > > Thanks a lot for point out! > > Charging in __read_swap_cache_async would ask for 3 layers function arguments > pass, that would be a bit ugly. Compare to this, could we move out the > lru_cache add after commit_charge, like ksm copied pages? > > That give a bit extra non lru list time, but the page just only be used only > after add_anon_rmap setting. Could it cause troubles? Hi Johannes & Andrew, Doing lru_cache_add_anon during swapin_readahead can give a very short timing for possible page reclaiming for these few pages. If we delay these few pages lru adding till after the vm_fault target page get memcg charging(mem_cgroup_commit_charge) and activate, we could skip the mem_cgroup_try_charge/commit_charge/cancel_charge process in __read_swap_cache_async(). But the cost is maximum SWAP_RA_ORDER_CEILING number pages on each cpu miss page reclaiming in a short time. On the other hand, save the target vm_fault page from reclaiming before activate it during that time. Judging the lose and gain, and the example of shmem/ksm copied pages, I believe it's fine to delay lru list adding till activate the target swapin page. Any comments are appreciated! Thanks Alex > > I tried to track down the reason of lru_cache_add here, but no explanation > till first git kernel commit. > > Thanks > Alex >