Received: by 10.223.176.5 with SMTP id f5csp3989949wra; Tue, 30 Jan 2018 00:00:33 -0800 (PST) X-Google-Smtp-Source: AH8x2264DwxF+NahMyGSQ+hA028KDYZDcrRfJhcWQBvgWu+EmBdicphNFzEmuAAo3naj+PSSvygF X-Received: by 10.98.107.71 with SMTP id g68mr28991972pfc.96.1517299233361; Tue, 30 Jan 2018 00:00:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517299233; cv=none; d=google.com; s=arc-20160816; b=ETneG4nl4E4XCqR+yWCgVbNkrvXsxxDg+Wt6b6WlraMtzGo6M1F17H3YZQXmOIW4// 3Ko4f5NW/FdPwzD64GGhHKWzpq50SR+MEAcaBEUUGyxRDtVC5ncGAOrbSLpy+zWWmSTP 7QevKrpat4Y9/YNqkWJCA6XnzkP384dXilYWz60PD6pyPsr6OW+lNdkkJN0+dafibODA iyeY82/+E7lThKdJWI15MnXXMYWjBaiciOKQQiPqt5mKpkFvP8NNajwio81yYdF4zbE2 IBdS/eZs108+Nd3gqjiXPEtNKUlrFpZyOOpIgzWasQh5paDZZGrJ/b72Smrmqf+YTq9X y3nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=Ae3dkCgOJ4j27dUdfSYf3fJBTsNIoqILS7a+LK8+HMA=; b=ePlOspy8cycILQ6BS+6a2iMinqp7SvxMPumVFg3VchNDfbRztbTh5c5QI/cipI0Nsr grqwiy3jwZP5C1aIgryfJq2Afo47a3Cl/nt8SiomuAlNF0vxTXMhC3PalQT4OCQFTYIn jrzYTDQBGznYJo1XS60rVOsSB/80m+GyM+1RUSDViHPLIH/TR0i2LBAlqO1Ic9Ucsw3q SbXPsqX6pnJlGb/OeD+NZUvD4gFF8Gv0mTWAm6ZhZN5kPQcbhUkZOcyup87/ihSYqZlW fOJSJP4KtTUictisSpbPh32BMi08cl2HuI0etfJ0CEwEYkuSivrb4f9BNFyf4Y2jDIOT 25pQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ay8-v6si912330plb.614.2018.01.30.00.00.17; Tue, 30 Jan 2018 00:00:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751669AbeA3H7x (ORCPT + 99 others); Tue, 30 Jan 2018 02:59:53 -0500 Received: from mx2.suse.de ([195.135.220.15]:55039 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751511AbeA3H7w (ORCPT ); Tue, 30 Jan 2018 02:59:52 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id F270DACF6; Tue, 30 Jan 2018 07:59:50 +0000 (UTC) Date: Tue, 30 Jan 2018 08:59:49 +0100 From: Michal Hocko To: Anshuman Khandual Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org Subject: Re: [RFC] mm/migrate: Add new migration reason MR_HUGETLB Message-ID: <20180130075949.GN21609@dhcp22.suse.cz> References: <20180130030714.6790-1-khandual@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180130030714.6790-1-khandual@linux.vnet.ibm.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 30-01-18 08:37:14, Anshuman Khandual wrote: > alloc_contig_range() initiates compaction and eventual migration for > the purpose of either CMA or HugeTLB allocation. At present, reason > code remains the same MR_CMA for either of those cases. Lets add a > new reason code which will differentiate the purpose of migration > as HugeTLB allocation instead. Why do we need it? > Signed-off-by: Anshuman Khandual > --- > include/linux/migrate.h | 1 + > include/trace/events/migrate.h | 3 ++- > mm/page_alloc.c | 14 ++++++++++---- > 3 files changed, 13 insertions(+), 5 deletions(-) > > diff --git a/include/linux/migrate.h b/include/linux/migrate.h > index a732598fcf83..44381c33a2bd 100644 > --- a/include/linux/migrate.h > +++ b/include/linux/migrate.h > @@ -26,6 +26,7 @@ enum migrate_reason { > MR_MEMPOLICY_MBIND, > MR_NUMA_MISPLACED, > MR_CMA, > + MR_HUGETLB, > MR_TYPES > }; > > diff --git a/include/trace/events/migrate.h b/include/trace/events/migrate.h > index bcf4daccd6be..61474c93f8f3 100644 > --- a/include/trace/events/migrate.h > +++ b/include/trace/events/migrate.h > @@ -20,7 +20,8 @@ > EM( MR_SYSCALL, "syscall_or_cpuset") \ > EM( MR_MEMPOLICY_MBIND, "mempolicy_mbind") \ > EM( MR_NUMA_MISPLACED, "numa_misplaced") \ > - EMe(MR_CMA, "cma") > + EM( MR_CMA, "cma") \ > + EMe(MR_HUGETLB, "hugetlb") > > /* > * First define the enums in the above macros to be exported to userspace > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 242565855d05..ce8a2f2d4994 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -7588,13 +7588,14 @@ static unsigned long pfn_max_align_up(unsigned long pfn) > > /* [start, end) must belong to a single zone. */ > static int __alloc_contig_migrate_range(struct compact_control *cc, > - unsigned long start, unsigned long end) > + unsigned long start, unsigned long end, > + unsigned migratetype) > { > /* This function is based on compact_zone() from compaction.c. */ > unsigned long nr_reclaimed; > unsigned long pfn = start; > unsigned int tries = 0; > - int ret = 0; > + int ret = 0, migrate_reason = 0; > > migrate_prep(); > > @@ -7621,8 +7622,13 @@ static int __alloc_contig_migrate_range(struct compact_control *cc, > &cc->migratepages); > cc->nr_migratepages -= nr_reclaimed; > > + if (migratetype == MIGRATE_CMA) > + migrate_reason = MR_CMA; > + else > + migrate_reason = MR_HUGETLB; > + > ret = migrate_pages(&cc->migratepages, new_page_alloc_contig, > - NULL, 0, cc->mode, MR_CMA); > + NULL, 0, cc->mode, migrate_reason); > } > if (ret < 0) { > putback_movable_pages(&cc->migratepages); > @@ -7710,7 +7716,7 @@ int alloc_contig_range(unsigned long start, unsigned long end, > * allocated. So, if we fall through be sure to clear ret so that > * -EBUSY is not accidentally used or returned to caller. > */ > - ret = __alloc_contig_migrate_range(&cc, start, end); > + ret = __alloc_contig_migrate_range(&cc, start, end, migratetype); > if (ret && ret != -EBUSY) > goto done; > ret =0; > -- > 2.11.0 > -- Michal Hocko SUSE Labs