Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp819630pxb; Tue, 12 Apr 2022 14:20:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUV1OFEitKI5wMHJ/xzqhLxTWC0/zhMjKrfTfNwA6XhKMXXx/09WXEftTggO8aWGmI9uyA X-Received: by 2002:a17:903:216:b0:156:1e8d:a81 with SMTP id r22-20020a170903021600b001561e8d0a81mr38583448plh.140.1649798433907; Tue, 12 Apr 2022 14:20:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649798433; cv=none; d=google.com; s=arc-20160816; b=lNnnPi6+zECz+tGIAS9m5qwCeCYR3Vj2qI04L4JHomrgnyrCNU/tO0ZuFEbvGhidQq pBFZpCv5RFYYc+PWWgHJjsk9+LgpITG3LmSGFW87aVhB2eJumcNIlN7AZ+PhUXwrfl2B NQao1PeiiBNJ2I0bwtusNmN1C8NmtS3ArQSAsQNLjkxGqyCunInabgsLEi2LNcOSGZnM vtClBGeCA4AdCT4oWq4xXJkCSVUlstWhlmq2mzgGAQzYKgnOhzjceaohMi6mSMgoupdh jIw/knsBQtSo4O6Pyx3ylosQrr3NMF+JgfenrQhTgI+lVPIS6a1MXyBiPsvnkp95CW+k DNGw== 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:from:references :cc:to:subject; bh=8gI1Rc1Vck7wneJJwvOM0Hg9K0aQlbOtvj2TQGaoZxY=; b=hy21Bb2s3d7rt6OkuULdY24K4JMs+iIlbpbfRKLaHb+xqakydL7Szhx8pARdyv2J3n DTHhHaCO26Eg7x+cgzRSUneiMtkOUCODkoESr1aR1a4sxKju7judYyaxlpxoxC85GIek gR49gFiFTIbUHqvpCuwwOVsOKmd2rAct9If/jsW+k7TyNodPWPxSDxbu6mQHHTqW5GUt QJedyQNVt8nHzrlbk3SGqeFYwiIYRXOaP+T63KIdEeW7z1cxhplYOEc1Y3lc9JP58yAO 3uivNjWpI3icd9FvXiWqxaSmK15FFGcDCtoxA5fBMIh624/Hh12v70HoUadVAoDb15Mc iHcA== 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:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id z11-20020a170903018b00b00153b2d165aasi396742plg.434.2022.04.12.14.20.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 14:20:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E23D9F9F97; Tue, 12 Apr 2022 13:33:43 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345783AbiDLNoi (ORCPT + 99 others); Tue, 12 Apr 2022 09:44:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236249AbiDLNoh (ORCPT ); Tue, 12 Apr 2022 09:44:37 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE3884ECCE for ; Tue, 12 Apr 2022 06:42:18 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Kd6MV07y1zdZcX; Tue, 12 Apr 2022 21:41:42 +0800 (CST) Received: from [10.174.177.76] (10.174.177.76) 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; Tue, 12 Apr 2022 21:42:16 +0800 Subject: Re: [PATCH v2 2/9] mm/vmscan: remove unneeded can_split_huge_page check To: Oscar Salvador CC: , , , , , , References: <20220409093500.10329-1-linmiaohe@huawei.com> <20220409093500.10329-3-linmiaohe@huawei.com> From: Miaohe Lin Message-ID: <7455b680-3d89-5d3e-ba0e-6e4358b114a2@huawei.com> Date: Tue, 12 Apr 2022 21:42:16 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.76] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 On 2022/4/12 16:59, Oscar Salvador wrote: > On Sat, Apr 09, 2022 at 05:34:53PM +0800, Miaohe Lin wrote: >> We don't need to check can_split_folio() because folio_maybe_dma_pinned() >> is checked before. It will avoid the long term pinned pages to be swapped >> out. And we can live with short term pinned pages. Without can_split_folio >> checking we can simplify the code. Also activate_locked can be changed to >> keep_locked as it's just short term pinning. > > What do you mean by "we can live with short term pinned pages"? > Does it mean that it was not pinned when we check > folio_maybe_dma_pinned() but now it is? > > To me it looks like the pinning is fluctuating and we rely on > split_folio_to_list() to see whether we succeed or not, and if not > we give it another spin in the next round? Yes. Short term pinned pages is relative to long term pinned pages and these pages won't be pinned for a noticeable time. So it's expected to split the folio successfully in the next round as the pinning is really fluctuating. Or am I miss something? Many thanks for your comment and reply! > >> Suggested-by: Huang, Ying >> Signed-off-by: Miaohe Lin >> --- >> mm/vmscan.c | 22 ++++++++-------------- >> 1 file changed, 8 insertions(+), 14 deletions(-) >> >> diff --git a/mm/vmscan.c b/mm/vmscan.c >> index 4a76be47bed1..01f5db75a507 100644 >> --- a/mm/vmscan.c >> +++ b/mm/vmscan.c >> @@ -1711,20 +1711,14 @@ static unsigned int shrink_page_list(struct list_head *page_list, >> goto keep_locked; >> if (folio_maybe_dma_pinned(folio)) >> goto keep_locked; >> - if (PageTransHuge(page)) { >> - /* cannot split THP, skip it */ >> - if (!can_split_folio(folio, NULL)) >> - goto activate_locked; >> - /* >> - * Split pages without a PMD map right >> - * away. Chances are some or all of the >> - * tail pages can be freed without IO. >> - */ >> - if (!folio_entire_mapcount(folio) && >> - split_folio_to_list(folio, >> - page_list)) >> - goto activate_locked; >> - } >> + /* >> + * Split pages without a PMD map right >> + * away. Chances are some or all of the >> + * tail pages can be freed without IO. >> + */ >> + if (PageTransHuge(page) && !folio_entire_mapcount(folio) && >> + split_folio_to_list(folio, page_list)) >> + goto keep_locked; >> if (!add_to_swap(page)) { >> if (!PageTransHuge(page)) >> goto activate_locked_split; >> -- >> 2.23.0 >> >> >