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 X-Spam-Level: X-Spam-Status: No, score=-15.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 392BEC433B4 for ; Wed, 28 Apr 2021 14:06:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 04F3A6140A for ; Wed, 28 Apr 2021 14:06:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240149AbhD1OHW (ORCPT ); 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