Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp648503pxy; Wed, 28 Apr 2021 11:11:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjjXfdaeq6f3YD2UI1eqi/qF+4d4gj13O0RNhWP6UXCHOR0XE4zTpzS7uPoa8WHWtAahHv X-Received: by 2002:aa7:998b:0:b029:27c:2c2b:7bd2 with SMTP id k11-20020aa7998b0000b029027c2c2b7bd2mr6072891pfh.67.1619633499304; Wed, 28 Apr 2021 11:11:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619633499; cv=none; d=google.com; s=arc-20160816; b=BFz7i6yw22ahHC2Sxnm4wV7HwKTmK7JSnZpy4Vi+dn5DCZ4zrpAxmClHetTRKUaHry ps1HA8uGPf5H/RcYb4KBml3/8rg79qw/AFXw1hwMaLAdz2mkv+uHK7Yyt9cjd6cO3B2J Wsa8pSEwkVF668IuAvttP8yDUKx/FcytbVPwZNLgkgXgids6L5QZiuIxNpVyQr2E5sOf kFvyqea/8x+EQXCLhIZB+AOlwwyHHh1ti8hzU1ygmtwW7/heGVGg9zQaUZOjCnYsEdsB iVUsUwrGEZCWFb3kmxitTzwitNpm0FX8jd7dd3AwQcLZRKneA6jkx7OoqCSbyAj6oC8t LkHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:references:cc :to:from:subject; bh=MxLFUjMZ71IDldhONV+ofzUNkhK9ocPfv8hiCrpH7Mo=; b=oyIHbGnBCxhM02kDZXPYiatbGFdKXJnZH1YAyd7uBBLWgBSyprbtt4HZBQxXwDv3nR hNlb8AcCJRuU3GUyP1vzQzshKUBVo+Ki8C8jU5DM1hsjSGUfmLE4dHsQhKX+3NWUUEYl lCyvqRxEPuCoCg45l+cZRlgVZ49fKcoSQSSSAn58OxnULHii0hQ6s4yuI9/ZxT0DbK8Z TkO9nGT9ldVRkPyfYJg+t6fZITZTR1NUuO3V6iOEQHYsyBv8qu8iY2h3fuzOmvKOFfRw vo3qE9aRM7syaWLOGsXEyT9KKFwORDi4ogqqBqsZlFw0dYWiN8LgoUV2PSWECar1ZAld Lrpw== 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 g2si7661902pji.28.2021.04.28.11.11.22; Wed, 28 Apr 2021 11:11:39 -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 S240129AbhD1OHW (ORCPT + 99 others); Wed, 28 Apr 2021 10:07:22 -0400 Received: from out30-42.freemail.mail.aliyun.com ([115.124.30.42]:40335 "EHLO out30-42.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231359AbhD1OHV (ORCPT ); Wed, 28 Apr 2021 10:07:21 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R531e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04394;MF=xuyu@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0UX4Z7HA_1619618792; Received: from xuyu-mbp15.local(mailfrom:xuyu@linux.alibaba.com fp:SMTPD_---0UX4Z7HA_1619618792) by smtp.aliyun-inc.com(127.0.0.1); Wed, 28 Apr 2021 22:06:33 +0800 Subject: Re: [PATCH] mm, compaction: avoid isolating pinned tmpfs pages From: Yu Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: akpm@linux-foundation.org References: Message-ID: Date: Wed, 28 Apr 2021 22:06:55 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/28/21 10:00 PM, Xu Yu wrote: > This makes pinned tmpfs pages bail out early in the process of page > migration, like what pinned anonymous pages do. > > Signed-off-by: Xu Yu > --- > mm/compaction.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/mm/compaction.c b/mm/compaction.c > index e04f4476e68e..78c3b992a1c9 100644 > --- a/mm/compaction.c > +++ b/mm/compaction.c > @@ -964,11 +964,11 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn, > } > > /* > - * Migration will fail if an anonymous page is pinned in memory, > - * so avoid taking lru_lock and isolating it unnecessarily in an > - * admittedly racy check. > + * Migration will fail if an anonymous or tmpfs page is pinned > + * in memory, so avoid taking lru_lock and isolating it > + * unnecessarily in an admittedly racy check. > */ > - if (!page_mapping(page) && > + if (!page_is_file_lru(page) && > page_count(page) > page_mapcount(page)) Sorry, this patch is flawed, since tmpfs page cache takes an extra page count. Please ignore this patch. > goto isolate_fail; > > -- Thanks, Yu