Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp219577ybk; Tue, 19 May 2020 20:35:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9pGhregI0pn8ig4xvPb+e8NNcgcOOZF1OhwEzGuS7aKDseyLhvhbk17qOkhpQxpJTxGQq X-Received: by 2002:a05:6402:13d9:: with SMTP id a25mr1595098edx.9.1589945708935; Tue, 19 May 2020 20:35:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589945708; cv=none; d=google.com; s=arc-20160816; b=tDxHyRh0AM11Uz6dRyU8gEEsjFXFH76FjXRShCzxMfRjoGaG6j5UJ3cvtVmcYE+srN bSP90FrXA5Z2fBYihlQqhnOJVMpARdhYYmBpncI2RAaR6EV1/1FhLnN42r75SG4YBS3V hcmhKuAvEgkjLWrI2cOnvgvOp3rjogl50hriWJJaBxSSPx+wZvXUFiv4kc/h8chsOj9R 11mJB5zMipBiK6ysnFZHy68Ordn9Y10fSXzVirvm/yWIuePnsS14GUYvGq5yUqG1XQ8E lezK8bWdXvA5ww3858IOEPj1ejDZerwIJZKw5+422fasBvfkG8if3XRgITPYueL4SOWT v5ZA== 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=ezyLMMrgbSfba5uAvKwLpv5JHdDcbhiyq4kkAQVyx+M=; b=XyrvuUdWnmP4qBjrx32qEVoZjovtuUKcDgEmP2VRRfty25KvzIPbcZY5ltFqBjS0M+ nmuNnspsXhYe//QHEaZyeEdaGS7JAV6sGxyySzC6EQYfgBE8EFjDJuDHHAV+ehJa86cy 6Vw5Tr97sQjCy615GIyB+SVzMNx2EearYeJ7QoMHpZ3Pi/tkmWQ4Lo6CeNgeL3pxFqLU bMBQNGTy0QPjhpND6itChAJa13C+T7jwaoU2BZy29Y9K8ndzknIheEiA20Une8czbWUG Hvh/BQmwB4sKfEfkNWpsSgQAw4nvMsyI92sSsoqs6kEc4IZk6xj6HvxIXfZ1JwTOYpwm ShYA== 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 t9si687555edw.135.2020.05.19.20.34.47; Tue, 19 May 2020 20:35:08 -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 S1728670AbgETDcp (ORCPT + 99 others); Tue, 19 May 2020 23:32:45 -0400 Received: from foss.arm.com ([217.140.110.172]:46564 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726432AbgETDcp (ORCPT ); Tue, 19 May 2020 23:32:45 -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 BAA5630E; Tue, 19 May 2020 20:32:44 -0700 (PDT) Received: from [10.163.75.101] (unknown [10.163.75.101]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C8F2E3F52E; Tue, 19 May 2020 20:32:42 -0700 (PDT) Subject: Re: [RFC V2] mm/vmstat: Add events for PMD based THP migration without split To: John Hubbard , linux-mm@kvack.org Cc: Naoya Horiguchi , Zi Yan , Andrew Morton , linux-kernel@vger.kernel.org References: <1589784156-28831-1-git-send-email-anshuman.khandual@arm.com> <67be2597-c019-63c1-b551-d4571a44f1a5@nvidia.com> From: Anshuman Khandual Message-ID: <88aa238d-9de1-9f6a-a3b0-51fbe073090d@arm.com> Date: Wed, 20 May 2020 09:02:07 +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: <67be2597-c019-63c1-b551-d4571a44f1a5@nvidia.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/19/2020 01:40 AM, John Hubbard wrote: > On 2020-05-17 23:42, Anshuman Khandual wrote: > ... >> diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h >> index ffef0f279747..23d8f9884c2b 100644 >> --- a/include/linux/vm_event_item.h >> +++ b/include/linux/vm_event_item.h >> @@ -91,6 +91,10 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, >>           THP_ZERO_PAGE_ALLOC_FAILED, >>           THP_SWPOUT, >>           THP_SWPOUT_FALLBACK, >> +#ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION > > > Hi Anshuman, > > These new events look great to me. I have some nits below, plus one > lightly controversial suggestion which I'd really like to have someone > more experienced weigh in on, which is: > > How about not being quite so granular on the THP config options, and > just guarding these events with the overall CONFIG_TRANSPARENT_HUGEPAGE > option, instead of the sub-option CONFIG_ARCH_ENABLE_THP_MIGRATION? > > I tentatively think it's harmless and not really misleading to have > /proc/vmstat showing this in all THP-enabled configurations: > > thp_pmd_migration_success 0 > thp_pmd_migration_failure 0 > > ...if THP is enabled, and *whether or not* _THP_MIGRATION is enabled. > And this simplifies things a bit. Given how the .config options can get, > I think simplifying would be nice. > > However, I'm ready to be corrected on that, if it's a bad idea for > other API reasons perhaps.  Can anyone please comment? There is no THP migration events to track unless it is enabled. Why to show these statistics (as 0) when its not even possible. If the config simplicity is the only intended rationale here, it might not be the case either. These events and their tracking would still need to be wrapped with CONFIG_TRANSPARENT_HUGEPAGE otherwise. If your concern is more towards CONFIG_ARCH_ENABLE_THP_MIGRATION being unsuitable or with complex dependencies, then that is something how THP migration feature itself is implemented currently and adding VM events does not address that. A possible patch in the future patch could solve all these (together). But sure, let's hear it for what others have to say on this. > > >> +        THP_PMD_MIGRATION_SUCCESS, >> +        THP_PMD_MIGRATION_FAILURE, >> +#endif >>   #endif >>   #ifdef CONFIG_MEMORY_BALLOON >>           BALLOON_INFLATE, >> diff --git a/mm/migrate.c b/mm/migrate.c >> index 7160c1556f79..5325700a3e90 100644 >> --- a/mm/migrate.c >> +++ b/mm/migrate.c >> @@ -1170,6 +1170,18 @@ static int __unmap_and_move(struct page *page, struct page *newpage, >>   #define ICE_noinline >>   #endif >>   +#ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION >> +static inline void thp_migration_success(bool success) > > > I think this should be named > >     thp_pmd_migration_success() > > , since that's what you're really counting. Or, you could > name the events THP_MIGRATION_SUCCESS|FAILURE. Either way, > just so the function name matches the events it's counting. Makes sense but IMHO we should keep _pmd_ to be more specific. Will change the name here as thp_pmd_migration_success(). > > >> +{ >> +    if (success) >> +        count_vm_event(THP_PMD_MIGRATION_SUCCESS); >> +    else >> +        count_vm_event(THP_PMD_MIGRATION_FAILURE); >> +} >> +#else >> +static inline void thp_migration_success(bool success) { } > > > This whole ifdef clause would disappear if my suggestion above is We will have to protect these with CONFIG_TRANSPARENT_HUGEPAGE as the events are still conditionally available. > accepted. However, if not, then I believe the convention for this > kind of situation is: > > static inline void thp_migration_success(bool success) > { > } AFAIK, we have examples both ways but will change if this is preferred.