Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp193176ybk; Thu, 14 May 2020 20:56:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxI+0NPyuVt5iFKfCY+XhngFRrJvl1MvuKLsVLpa/sRYIte15ZMcfodDSHa1iVrv2vNkAgQ X-Received: by 2002:a17:906:410a:: with SMTP id j10mr1004981ejk.378.1589514964942; Thu, 14 May 2020 20:56:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589514964; cv=none; d=google.com; s=arc-20160816; b=r//nijG4BxCDvG8i+JdOMhhdl4OowCxkRO6sVaAw7r8teqLBBaqfpfo0beuom9QcmG rk3ptk52/kxuYozUMFuA9L5A5zKSg+BzRn7ICYWHiEbJj5pmFb0kXP0RseQdfEB/CwC2 nXxL9IWUdxr7/YTcwJqUHpRjrTseuStTLIrk8RaUUCayRI2HXNnQ1vivCcH35fws02+m gVboSfGVo4WuEEIj29fB/ZX/mY6A15FqhpyTQwlioSFtyVd1+kYttBb87PlImT/py3ME whPTKlK0rc3WcxLQX4D/U9BvRRFV3VXR0uocBPw3ZHl1k/TAS1s4+k4KbQhv2Of1hXeM bFFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=EX5zZhiW09Ub8HBJb4UaXBPfqkKq/2sehpBoxNytSPo=; b=g4X1HcBsrcpeoCnAjctEWoTCfxOHnCV1oarTfzgGus41M8kgrpu6XCJmOSmxNFEyCr BSoqDapvqN9Wf8BIj5unjZiqoMCzA6BaHAacMB3GKS8c1pcuNUfO8zctOX6g2Y7JHz52 eaWA/e4h2fBVn12teZvB3ts8KffMC78pB3ouGc3NdiZYj/9/LsY/IHEA2sWHUMlmajw/ pivAW8gngJ8m18BzLXyDyPqdi7MB4Iwc7WCLIwaqLUVZLH3DBdi3GaQLWCJz2Xd1JNFd ggisjtbbG6aRAjwxw5HGgNTnoJ7FSG/UWQZ0Yv9vfLOLCHljmKoNgTLBBEalOpqg3FVL NKtw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gr24si527717ejb.7.2020.05.14.20.55.41; Thu, 14 May 2020 20:56:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727946AbgEODvW (ORCPT + 99 others); Thu, 14 May 2020 23:51:22 -0400 Received: from foss.arm.com ([217.140.110.172]:48118 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726665AbgEODvW (ORCPT ); Thu, 14 May 2020 23:51:22 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C82741042; Thu, 14 May 2020 20:51:21 -0700 (PDT) Received: from [192.168.0.129] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0B4B83F305; Thu, 14 May 2020 20:51:19 -0700 (PDT) Subject: Re: [RFC] mm/vmstat: Add events for THP migration without split To: Zi Yan Cc: linux-mm@kvack.org, Andrew Morton , "Kirill A. Shutemov" , linux-kernel@vger.kernel.org References: <1589257372-29576-1-git-send-email-anshuman.khandual@arm.com> <67C72AD3-120C-4825-B67B-AECD4245EC4E@nvidia.com> From: Anshuman Khandual Message-ID: <7b4504c8-8583-d426-fef1-4c14986798c3@arm.com> Date: Fri, 15 May 2020 09:20:43 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <67C72AD3-120C-4825-B67B-AECD4245EC4E@nvidia.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/14/2020 07:58 PM, Zi Yan wrote: > On 12 May 2020, at 0:22, Anshuman Khandual wrote: > >> Add the following new trace events which will help in validating migration >> events involving PMD based THP pages. >> >> 1. THP_PMD_MIGRATION_ENTRY_SET >> 2. THP_PMD_MIGRATION_ENTRY_REMOVE >> >> There are no clear method to confirm whether a THP migration happened with >> out involving it's split. These trace events along with PGMIGRATE_SUCCESS >> and PGMIGRATE_FAILURE will provide additional insights. After this change, >> >> A single 2M THP (2K base page) when migrated >> >> 1. Without split >> >> ................ >> pgmigrate_success 1 >> pgmigrate_fail 0 >> ................ >> thp_pmd_migration_entry_set 1 >> thp_pmd_migration_entry_remove 1 >> ................ >> >> 2. With split >> >> ................ >> pgmigrate_success 512 >> pgmigrate_fail 0 >> ................ >> thp_pmd_migration_entry_set 0 >> thp_pmd_migration_entry_remove 0 >> ................ >> >> pgmigrate_success as 1 instead of 512, provides a hint for possible THP >> migration event. But then it gets mixed with normal page migrations over >> time. These additional trace events provide required co-relation. > > To track successful THP migrations, the code below should work, right? > > diff --git a/mm/migrate.c b/mm/migrate.c > index b1092876e537..d394f5331288 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -1220,6 +1220,8 @@ static ICE_noinline int unmap_and_move(new_page_t get_new_page, > * we want to retry. > */ > if (rc == MIGRATEPAGE_SUCCESS) { > + if (PageTransHuge(newpage)) > + count_vm_event(THP_PMD_MIGRATION_SUCCESS); Thats right. > put_page(page); > if (reason == MR_MEMORY_FAILURE) { > /* Another THP_PMD_MIGRATION_FAILURE event in migrate_pages() when the THP gets split as a huge page could not be allocated. Both THP_PMD_MIGRATION_SUCCESS and THP_PMD_MIGRATION_FAILURE will provide a better understanding regarding THP migration events on the system. > > Maybe you could give more details on why you want to add the THP migration event and > how you are going to use the event in your use case. That would be very helpful to this > code review. Are you going to do anything if you see THP migration failures? Not at the moment. Like other VM events these new ones will provide required statistics (and better understanding) on THP migration which can be used to improve it further. Follows the same good old principle, if we cannot measure we cannot improve.