From patchwork Wed Apr 28 14:00:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yu X-Patchwork-Id: 12228941 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=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_GIT 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 844A7C433B4 for ; Wed, 28 Apr 2021 14:00:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9342161443 for ; Wed, 28 Apr 2021 14:00:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9342161443 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9A5756B0036; Wed, 28 Apr 2021 10:00:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 955946B006E; Wed, 28 Apr 2021 10:00:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 843ED6B0070; Wed, 28 Apr 2021 10:00:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0154.hostedemail.com [216.40.44.154]) by kanga.kvack.org (Postfix) with ESMTP id 6C6D06B0036 for ; Wed, 28 Apr 2021 10:00:25 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 1EF35181AF5C4 for ; Wed, 28 Apr 2021 14:00:25 +0000 (UTC) X-FDA: 78081935610.01.CCE0915 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) by imf09.hostedemail.com (Postfix) with ESMTP id D8B6C601D8EC for ; Wed, 28 Apr 2021 14:00:15 +0000 (UTC) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R451e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01424;MF=xuyu@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0UX52TuL_1619618418; Received: from localhost(mailfrom:xuyu@linux.alibaba.com fp:SMTPD_---0UX52TuL_1619618418) by smtp.aliyun-inc.com(127.0.0.1); Wed, 28 Apr 2021 22:00:18 +0800 From: Xu Yu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: akpm@linux-foundation.org Subject: [PATCH] mm, compaction: avoid isolating pinned tmpfs pages Date: Wed, 28 Apr 2021 22:00:14 +0800 Message-Id: X-Mailer: git-send-email 2.20.1.2432.ga663e714 MIME-Version: 1.0 X-Stat-Signature: zd8m6grs98owo6jbfn7nou3ff9d39ohk X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: D8B6C601D8EC Received-SPF: none (linux.alibaba.com>: No applicable sender policy available) receiver=imf09; identity=mailfrom; envelope-from=""; helo=out30-131.freemail.mail.aliyun.com; client-ip=115.124.30.131 X-HE-DKIM-Result: none/none X-HE-Tag: 1619618415-967437 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: 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)) goto isolate_fail;