Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp11816597rwd; Thu, 22 Jun 2023 19:54:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4vWgoGZXV/MkKcU0cXVpxzMLzkXO9GdkTHLMIY5FozVZPaLpfthpmCxIO8c8I45PJNhWDR X-Received: by 2002:a05:6a21:6d86:b0:122:e4f:25c7 with SMTP id wl6-20020a056a216d8600b001220e4f25c7mr12016469pzb.31.1687488852248; Thu, 22 Jun 2023 19:54:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687488852; cv=none; d=google.com; s=arc-20160816; b=EqE6yh7TQDMV1PCz7FlvccufxuYAvzAmvnFd4PC7TxjH0I+0U7iQRiKplWN25tO1p/ I43LTaUinvIZgyytYOXwTMrT6iyE1qzlUojk5G5ZjIAOoP90sOs+sKQhveZ17sNydJq4 Mdt/47P6NGUiTtx5xa6hc91/z8mqaYfv5pVkJLRma6t+jsRAp0ShlFZxaw8LXQQkyBSk RFR8U7TWDXs1V3M0e49NL4Z/72HBMpDHUYhCS7nXEENTYDK3dz1CyZhG8EzvFSEzxu6C 8jJdA3j/Ss7CtLS963Fur88RvAeXTJDlDV+KZYNMAwtGbSaBZwzmj/QCbmWgBUUww7GU QkWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=MzhV9LhSS9unc5IWnsa4gXYgrk+O0TYDKFcPL/jvg7I=; b=JcTcIKOse4ks33ozxkxsLrU72RZPUngC+3CG4k8Jcqq9IXIAerkHe7BU4DpmzdTAn3 EeaT77A1SVnY+2DNEajYyDJkuJWumdKa0O2ajwbe0zkI6XcvnHN24HIxVEOemuHykfOK niRmK2LVgyG1IV1D5F3rUJUG/aBVIfKKz4ubH/TylZCQEclkcRT5HNZtbeaVL/PIFmuE mbgD6ctPXS9fewQz5HOWu+Y3NY8Lw7e5K9vO4hP+EMZHvOMdGRlqOfmaxG+9AYDoIxA/ Hi+azRS5wo7wNM76U16+9D4bLyRhAG8CP8/fPPNDV/P0bVoodd6OGqfPoYNPklVYzRIa d3ng== 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=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id la7-20020a170902fa0700b001b04c325d66si7177255plb.565.2023.06.22.19.54.00; Thu, 22 Jun 2023 19:54:12 -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=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229930AbjFWCHS (ORCPT + 99 others); Thu, 22 Jun 2023 22:07:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229647AbjFWCHR (ORCPT ); Thu, 22 Jun 2023 22:07:17 -0400 Received: from out30-99.freemail.mail.aliyun.com (out30-99.freemail.mail.aliyun.com [115.124.30.99]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA06B2122 for ; Thu, 22 Jun 2023 19:07:14 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R141e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046056;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0VlkdzUw_1687486029; Received: from 192.168.0.106(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VlkdzUw_1687486029) by smtp.aliyun-inc.com; Fri, 23 Jun 2023 10:07:10 +0800 Message-ID: <9ff605a5-a989-01f2-e629-e52bb50201a7@linux.alibaba.com> Date: Fri, 23 Jun 2023 10:07:30 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.11.2 Subject: Re: [PATCH v3] mm: Fix shmem THP counters on migration To: Jan Glauber , akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Huang, Ying" References: <20230622094720.510540-1-jglauber@digitalocean.com> From: Baolin Wang In-Reply-To: <20230622094720.510540-1-jglauber@digitalocean.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL 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 On 6/22/2023 5:47 PM, Jan Glauber wrote: > The per node numa_stat values for shmem don't change on > page migration for THP: > > grep shmem /sys/fs/cgroup/machine.slice/.../memory.numa_stat: > > shmem N0=1092616192 N1=10485760 > shmem_thp N0=1092616192 N1=10485760 > > migratepages 9181 0 1: > > shmem N0=0 N1=1103101952 > shmem_thp N0=1092616192 N1=10485760 > > Fix that by updating shmem_thp counters likewise to shmem counters > on page migration. > > Signed-off-by: Jan Glauber LGTM. Thanks. Reviewed-by: Baolin Wang > --- > v3: Use folio_test_pmd_mappable instead of folio_test_transhuge > v2: Fix compile error > --- > mm/migrate.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/mm/migrate.c b/mm/migrate.c > index 01cac26a3127..6ef8b1dea2e6 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -492,6 +492,11 @@ int folio_migrate_mapping(struct address_space *mapping, > if (folio_test_swapbacked(folio) && !folio_test_swapcache(folio)) { > __mod_lruvec_state(old_lruvec, NR_SHMEM, -nr); > __mod_lruvec_state(new_lruvec, NR_SHMEM, nr); > + > + if (folio_test_pmd_mappable(folio)) { > + __mod_lruvec_state(old_lruvec, NR_SHMEM_THPS, -nr); > + __mod_lruvec_state(new_lruvec, NR_SHMEM_THPS, nr); > + } > } > #ifdef CONFIG_SWAP > if (folio_test_swapcache(folio)) {