Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp171787pxb; Mon, 11 Apr 2022 22:09:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGfq9KfVi7uRJKswfkyWbXsMpw3VCOLLK0sdpDOGTjlfSHQ1xA63SMzJNlWLugal1HwgBk X-Received: by 2002:a63:7d02:0:b0:398:9594:63f4 with SMTP id y2-20020a637d02000000b00398959463f4mr28700282pgc.375.1649740146786; Mon, 11 Apr 2022 22:09:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649740146; cv=none; d=google.com; s=arc-20160816; b=0N5JSxWWftetraBFTnZnweR2TqoQdiRFu3uRW+H76xFSv26glH26IiN0eNqYR8f+GP DpZJ+qsItZYsS3I5Ky19SsEj3LBo14y0pWeElA/8ACb2GaK/ROtXOn2vCsgXBoWIV74S xsqBEc5aNtN8dt+kWGcqI/HtzcUTnkVLSXnFQ5m3c1pTTgm0cOlQHrI258u0P18o4wG2 CiUZLsqvg0z773LM4tIXmo1IVDNEzguaDKcN/LcFVbvwbwidSA5IydHNbZSBgM5TCrDx lJI/wL+3Yb1c2gyNsvdlwMwMczgcDnP+gBfdjMsK+lzahhtDDEi2ZI0K2zO0ZtGjSGtA s/GA== 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:date:subject:cc:to:from; bh=pd0vXJ7aL91JI+JEwvDwQKy7CFlfwIT2bTJkZSyAyqs=; b=uCtUlHCCk62eW679YKaPkn7rkB6uzqV4A3JOIxVPug0/4U8SV18gydcDi015KwPQp4 EFSfA0dLbByan4fQtj/Kd7h4P8o8pq53gBw2RKq9gTQB9jPC6ULcd7ZMQQ5P/aU0a2Z5 5pWDGnZidKsh+rnppepfN2JS/QJ8cBZXmeNgRytvfyO0ed6XQvk97q9cdnPzepjJ9N7X paGERNlgm73IlNha7VFz9gIzdSPowirOVNALc5JYhRwxyYVHhEsZy3Hk+VTWSqUZpK1y uYWSVLf+krSXpGCnrtyNznwJRDUMGvmMyWiT3BDztBG8aTJ6UcGT6P/XYXnaZCOvCfBX osfw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i7-20020a628707000000b004fae310a83csi10334865pfe.151.2022.04.11.22.08.52; Mon, 11 Apr 2022 22:09:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241347AbiDIJg7 (ORCPT + 99 others); Sat, 9 Apr 2022 05:36:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241175AbiDIJgj (ORCPT ); Sat, 9 Apr 2022 05:36:39 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5457ABBE29 for ; Sat, 9 Apr 2022 02:34:33 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Kb8zd0hbwzgYKZ; Sat, 9 Apr 2022 17:32:45 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Sat, 9 Apr 2022 17:34:31 +0800 From: Miaohe Lin To: CC: , , , , , , Subject: [PATCH v2 5/9] mm/vmscan: activate swap-backed executable folios after first usage Date: Sat, 9 Apr 2022 17:34:56 +0800 Message-ID: <20220409093500.10329-6-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220409093500.10329-1-linmiaohe@huawei.com> References: <20220409093500.10329-1-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 We should activate swap-backed executable folios (e.g. tmpfs) after first usage so that executable code gets yet better chance to stay in memory. Suggested-by: Huang, Ying Signed-off-by: Miaohe Lin Cc: Joonsoo Kim --- mm/vmscan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 0e5818970998..cc1193e320c2 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1412,9 +1412,9 @@ static enum page_references folio_check_references(struct folio *folio, return PAGEREF_ACTIVATE; /* - * Activate file-backed executable folios after first usage. + * Activate executable folios after first usage. */ - if ((vm_flags & VM_EXEC) && !folio_test_swapbacked(folio)) + if (vm_flags & VM_EXEC) return PAGEREF_ACTIVATE; return PAGEREF_KEEP; -- 2.23.0