From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D810E77184 for ; Tue, 17 Dec 2024 08:49:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D069D6B00C4; Tue, 17 Dec 2024 03:49:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CB60A6B00C5; Tue, 17 Dec 2024 03:49:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B30526B00C6; Tue, 17 Dec 2024 03:49:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 8C3AA6B00C4 for ; Tue, 17 Dec 2024 03:49:56 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id BD9B7C0548 for ; Tue, 17 Dec 2024 08:49:55 +0000 (UTC) X-FDA: 82903827216.07.AD534ED Received: from mail-vk1-f172.google.com (mail-vk1-f172.google.com [209.85.221.172]) by imf24.hostedemail.com (Postfix) with ESMTP id EC46C18001B for ; Tue, 17 Dec 2024 08:49:49 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=na085hog; spf=pass (imf24.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.221.172 as permitted sender) smtp.mailfrom=21cnbao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734425373; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=nDh+AuPWF1SU5dHFbExARYLYQDKduF5FdUoJg6qcAUg=; b=Y68RSKXB9dokPKxnBDbwibOqOjSXYlAvgNiQKWfuDNHMdU64yiJkZ8mwfgcrM2Tvx5FOJb bKag9WTj+bTjJY3p8nurxwR90QzjKwYO1rOXhCwnkiuXK2jtHgRa7csDQpKp/E+rgay5Zm 0wu1kHgTXv0c93SCmLBgle26631g0mI= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=na085hog; spf=pass (imf24.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.221.172 as permitted sender) smtp.mailfrom=21cnbao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734425373; a=rsa-sha256; cv=none; b=HHFgwNElNtoU6JH3Gpc4MB8/lKiBRK78WaCtGYVVmyHcpXa9oWySLOqCOur+a1ag5x7i/E SvVIZb7PBkFc98qHKL1YW6UG8yLZ0UGyDV5lE0flEQQFLT9fw6ND6LLC2l9ZiY5ww//kja xfackw1YQjs7JUwSrcg0Hl3fDUoUdJU= Received: by mail-vk1-f172.google.com with SMTP id 71dfb90a1353d-5174f298e18so1326849e0c.2 for ; Tue, 17 Dec 2024 00:49:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734425393; x=1735030193; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=nDh+AuPWF1SU5dHFbExARYLYQDKduF5FdUoJg6qcAUg=; b=na085hogcK0UExn0AXOCbf19IW+LT/1AiHw7jYIa9emXnt41j8f/V3xqrLxArXhZJi Ktt4u0yK65D3z8g+KVEnjlBLYD+Mc4VuKhDZWiQjy3llPNfZGPa+2sEjsqHvSvE0qtgz u0rmHRctPYNywglzIUlEu9H/RWVJmuVSk1eZqqrjZcn83pmIw9NhtBEwdpF1c508/u9S 6zd3uT7CEUdGrGtnSJ2KHdwPgO4ThOIflLJJvOdXSUfRBCexKTih37nsaP4a//cN59dP aX1I0ZiuzuW5KByRokiFzC9UUYUwI/lonPZS418YDTIpeqN3RwoNubnL6lYj9DrRuVAZ 2kDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734425393; x=1735030193; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nDh+AuPWF1SU5dHFbExARYLYQDKduF5FdUoJg6qcAUg=; b=UzmGiAZqyobhl9Y4mAqDB2Z/Y/sPXG5dq0zZPAqTRC9Fv7lYnBuvXXD+UksXNNfyaQ B63TL1eYJ1DZnhNZYUXMnz8Kz10CWZuzw2ROinK4oglhr1ryCpCzX869mEXNIi8BF+jd GS18Zq8keFPwBU9lJBOMPgSNm6B6X/fRJHzL26or+aqxYOrBE1Cwz1XQA16JqEsyrw96 GrPwhYBHLKuRQjmzYyJ0ICcjC6B5uhMQJzlGbKwWF8BT0zlqwIdRs1cdM90flX9niwV2 8n2ydOZuhsTkV6YqPg0juuaHRANwRZ1//KuRIKWQCVizOuiBJCD/sAqdWX+LduM1hy7b x2ug== X-Forwarded-Encrypted: i=1; AJvYcCVgmjbUS0ruVvJQw2UNmEN04EOBhal2fgO9XIbHBgnytX9FABpncMvL4c9Iyy1Lf2FQRiT6K2eFVg==@kvack.org X-Gm-Message-State: AOJu0Yyhnpk3jQRDHgBqasn8nJmH0184cXF4ugDSmSH0X2levwjbmp3z hYs/Zvbf5haOrZ+9X+COXJB4fzWfVrZo6bY3oGZVTTL2yl/FVvzObd+Hsa+mbU+giBrdygZp/KV KK8tPi7DrlII1SYzMSrodXYjr7Ag= X-Gm-Gg: ASbGnctdY7tXHL8SYk+/T+Id2YZX5iaDSZHnJSEsQJcfJESJ7VljdXZ0x4hJkQ/xDAg iuGCYwAQug/EdwlnAra6pz0uHeG9I3SHF9CCVLnQzqG8el1gFMPfM14p371w9vQNMHL7HGw9G X-Google-Smtp-Source: AGHT+IHOXnihCapee+0OlQQt3O2x48A/4B8dvgMZGsYwAEBPAAqcc3Z5WuWDq9xQcD7jFMz8Q4rpjdqTywRBONAgAnc= X-Received: by 2002:a05:6122:d05:b0:518:791a:3462 with SMTP id 71dfb90a1353d-51a243614c6mr3411119e0c.9.1734425392654; Tue, 17 Dec 2024 00:49:52 -0800 (PST) MIME-Version: 1.0 References: <1734406405-25847-1-git-send-email-yangge1116@126.com> In-Reply-To: From: Barry Song <21cnbao@gmail.com> Date: Tue, 17 Dec 2024 21:49:40 +1300 Message-ID: Subject: Re: [PATCH V6] mm, compaction: don't use ALLOC_CMA in long term GUP flow To: Ge Yang Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, david@redhat.com, baolin.wang@linux.alibaba.com, vbabka@suse.cz, liuzixing@hygon.cn Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam05 X-Stat-Signature: yke9qjibztw3w5e9fii9k6ztae88g31x X-Rspamd-Queue-Id: EC46C18001B X-Rspam-User: X-HE-Tag: 1734425389-526287 X-HE-Meta: U2FsdGVkX1+A2qM0qg8TPhCRf6eiCjThZGicU/zHpfFuMAsVLQtb2hmIe1kMt7n91cJGwHR2wpeOpVCtMZrUg3IE4eWH+xa55PCf9A60UHlsrb+Au78VfzOgB0KiGslT4B2TXz6kmmnczRnwcWCkPVkBdmA3qqFlRT1FuETk0UX7IMuATQ+ip4y9Zgj99uTTpWIhh3RmoW7dqODCAawXPO61zajNdGAqJ9k77/blnLHroJWzYQADLwaCBDrA/joPUiUSuGjH6kkV3JicIzF9mjyUlo6ekhA56ZuRHJFYIdreW/zwUru+dFjoJGuIU/y/N3q8sXYtN3qUDXFaqz6Twh8GNjlOH4To9gh54kjPYlqXuOgDRkfLqRa/zMjJHtgRlt0TR4oDpZvUcqya+JwwQL9vFhUqOz8MDvK41yGsu0t4vag1+/1G0+u7N17EUJSWe0zcEvgCPuISZaUMweVSKjKxt1pnW5fEa/y8Iy816w8EV3Oh6jX3eyAONmci0AFtCbtTXZM9sObzQ8UWVqDNJH4kt8AGyyAAgiE9OJJ2vIn5U/B8fjrO+wmU1pwVnNyoRDNelieajBI6GwfGAYVPsZQYsXvZ1Sl1oH0w4zMBa2sROeQCxVqkZu1lBZHd3okPEsl9u4QrwJhP80CsUVeMFAbWyI/6uc4/wHrMJsiiLLKJkOvOBsY/VxhoXOf4JeCUOuR/RVptfoy0QJhpenBvmZCMUZr1GlfUa5XsLzaHFBGH3+Y/6UpBYZ9tHuy7s2nhnzm8UvOQIPF+tM80QJ4t9MavbY9EzXrlvigp/hgCYjSEgsoq88gHpbdQEDNZTQSrOmDOQG6FtnkzKalGh2M8XXtZKtHgfZ83P6CktZ/j6lOpeNVv5dtLB2emZTY/4oQnH210sESDMHbhyjS3VQtBiG+PGnL2e/xqt7B5HDn21Ll34+chvEuUMqOt1uaJOcj83BcrgkmelSmNBKe3jpK gt6ycynW lxq1T4VaaMyLSb2ce8oNiNDlAGfruDF7ECN1eLmK4Tkzkb/MHlLUWd1TNnuY+CoXrrqiGKMua/HrrfizoB9SV40F4vyY9tDJ2FqQFZ6dNpWndmWxQT1FJ64kYTZ1HOS8sFsBFnrWIhWK36tPP1VvjCUDEBsI8JiVy3Q/Psc4cmh7FJytC5RJblJCEafzt9waXrvij7/kyQLzcbiNIptk9idhIzmDR9eMfOn0pSUHG6ppErH7XmbwTidDoOGV0tmgNhkaX9QHDLT2O1s5nKaeLDkdgIXlVrC6hBi5Ahaie1A9hywO1yig6ryGB9hKEbp9vTN3Xth14y7qX6/3n8P1g58XkKdenVgXMvN8su3rrLOI+iS+ObexVtLlehGsM+/PZBXqEG/dD+XvGR+E9FT5FuTNijR4nBcw3RqphEJUBxKZ0jLbw61jmwgf8oD24SEszaL7zLAUNVgIm2bKugsZ1t9mZ9A== X-Bogosity: Ham, tests=bogofilter, spamicity=0.138276, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Tue, Dec 17, 2024 at 8:12=E2=80=AFPM Ge Yang wrote: > > > > =E5=9C=A8 2024/12/17 14:14, Barry Song =E5=86=99=E9=81=93: > > On Tue, Dec 17, 2024 at 4:33=E2=80=AFPM wrote: > >> > >> From: yangge > >> > >> Since commit 984fdba6a32e ("mm, compaction: use proper alloc_flags > >> in __compaction_suitable()") allow compaction to proceed when free > >> pages required for compaction reside in the CMA pageblocks, it's > >> possible that __compaction_suitable() always returns true, and in > >> some cases, it's not acceptable. > >> > >> There are 4 NUMA nodes on my machine, and each NUMA node has 32GB > >> of memory. I have configured 16GB of CMA memory on each NUMA node, > >> and starting a 32GB virtual machine with device passthrough is > >> extremely slow, taking almost an hour. > >> > >> During the start-up of the virtual machine, it will call > >> pin_user_pages_remote(..., FOLL_LONGTERM, ...) to allocate memory. > >> Long term GUP cannot allocate memory from CMA area, so a maximum > >> of 16 GB of no-CMA memory on a NUMA node can be used as virtual > >> machine memory. Since there is 16G of free CMA memory on the NUMA > > > > Other unmovable allocations, like dma_buf, which can be large in a > > Linux system, are > > also unable to allocate memory from CMA. My question is whether the iss= ue you > > described applies to these allocations as well. > pin_user_pages_remote(..., FOLL_LONGTERM, ...) first attemps to allocate > THP only on local node, and then fall back to remote NUMA nodes if the > local allocation fail. For detail, see alloc_pages_mpol(). > > static struct page *alloc_pages_mpol() > { > page =3D __alloc_frozen_pages_noprof(__GFP_THISNODE,...); // 1, try > to allocate THP only on local node > > if (page || !(gpf & __GFP_DIRECT_RECLAIM)) > return page; > > page =3D __alloc_frozen_pages_noprof(gfp, order, nid, nodemask);//2, > fall back to remote NUMA nodes > } > > If dma_buf also uses the same way to allocate memory=EF=BC=8Cdma_buf will= also > have this problem. Imagine we have only one NUMA node and no remote nodes to 'borrow' memory from. What would happen as a result of this bug? > > > > >> node, watermark for order-0 always be met for compaction, so > >> __compaction_suitable() always returns true, even if the node is > >> unable to allocate non-CMA memory for the virtual machine. > >> > >> For costly allocations, because __compaction_suitable() always > >> returns true, __alloc_pages_slowpath() can't exit at the appropriate > >> place, resulting in excessively long virtual machine startup times. > >> Call trace: > >> __alloc_pages_slowpath > >> if (compact_result =3D=3D COMPACT_SKIPPED || > >> compact_result =3D=3D COMPACT_DEFERRED) > >> goto nopage; // should exit __alloc_pages_slowpath() from her= e > >> > > > > Do we face the same issue if we allocate dma-buf while CMA has plenty > > of free memory, but non-CMA has none? > > > >> In order to quickly fall back to remote node, we should remove > >> ALLOC_CMA both in __compaction_suitable() and __isolate_free_page() > >> in long term GUP flow. After this fix, starting a 32GB virtual machine > >> with device passthrough takes only a few seconds. > >> > >> Fixes: 984fdba6a32e ("mm, compaction: use proper alloc_flags in __comp= action_suitable()") > >> Cc: > >> Signed-off-by: yangge > >> Reviewed-by: Baolin Wang > >> --- > >> > >> V6: > >> -- update cc->alloc_flags to keep the original loginc > >> > >> V5: > >> - add 'alloc_flags' parameter for __isolate_free_page() > >> - remove 'usa_cma' variable > >> > >> V4: > >> - rich the commit log description > >> > >> V3: > >> - fix build errors > >> - add ALLOC_CMA both in should_continue_reclaim() and compaction_ready= () > >> > >> V2: > >> - using the 'cc->alloc_flags' to determin if 'ALLOC_CMA' is needed > >> - rich the commit log description > >> > >> include/linux/compaction.h | 6 ++++-- > >> mm/compaction.c | 26 +++++++++++++++----------- > >> mm/internal.h | 3 ++- > >> mm/page_alloc.c | 7 +++++-- > >> mm/page_isolation.c | 3 ++- > >> mm/page_reporting.c | 2 +- > >> mm/vmscan.c | 4 ++-- > >> 7 files changed, 31 insertions(+), 20 deletions(-) > >> > >> diff --git a/include/linux/compaction.h b/include/linux/compaction.h > >> index e947764..b4c3ac3 100644 > >> --- a/include/linux/compaction.h > >> +++ b/include/linux/compaction.h > >> @@ -90,7 +90,8 @@ extern enum compact_result try_to_compact_pages(gfp_= t gfp_mask, > >> struct page **page); > >> extern void reset_isolation_suitable(pg_data_t *pgdat); > >> extern bool compaction_suitable(struct zone *zone, int order, > >> - int highest_zoneidx); > >> + int highest_zoneidx, > >> + unsigned int alloc_flag= s); > >> > >> extern void compaction_defer_reset(struct zone *zone, int order, > >> bool alloc_success); > >> @@ -108,7 +109,8 @@ static inline void reset_isolation_suitable(pg_dat= a_t *pgdat) > >> } > >> > >> static inline bool compaction_suitable(struct zone *zone, int order, > >> - int highest_zone= idx) > >> + int highest_zone= idx, > >> + unsigned int all= oc_flags) > >> { > >> return false; > >> } > >> diff --git a/mm/compaction.c b/mm/compaction.c > >> index 07bd227..d92ba6c 100644 > >> --- a/mm/compaction.c > >> +++ b/mm/compaction.c > >> @@ -655,7 +655,7 @@ static unsigned long isolate_freepages_block(struc= t compact_control *cc, > >> > >> /* Found a free page, will break it into order-0 page= s */ > >> order =3D buddy_order(page); > >> - isolated =3D __isolate_free_page(page, order); > >> + isolated =3D __isolate_free_page(page, order, cc->allo= c_flags); > >> if (!isolated) > >> break; > >> set_page_private(page, order); > >> @@ -1634,7 +1634,7 @@ static void fast_isolate_freepages(struct compac= t_control *cc) > >> > >> /* Isolate the page if available */ > >> if (page) { > >> - if (__isolate_free_page(page, order)) { > >> + if (__isolate_free_page(page, order, cc->alloc= _flags)) { > >> set_page_private(page, order); > >> nr_isolated =3D 1 << order; > >> nr_scanned +=3D nr_isolated - 1; > >> @@ -2381,6 +2381,7 @@ static enum compact_result compact_finished(stru= ct compact_control *cc) > >> > >> static bool __compaction_suitable(struct zone *zone, int order, > >> int highest_zoneidx, > >> + unsigned int alloc_flags, > >> unsigned long wmark_target) > >> { > >> unsigned long watermark; > >> @@ -2395,25 +2396,26 @@ static bool __compaction_suitable(struct zone = *zone, int order, > >> * even if compaction succeeds. > >> * For costly orders, we require low watermark instead of min= for > >> * compaction to proceed to increase its chances. > >> - * ALLOC_CMA is used, as pages in CMA pageblocks are considere= d > >> - * suitable migration targets > >> + * In addition to long term GUP flow, ALLOC_CMA is used, as pa= ges in > >> + * CMA pageblocks are considered suitable migration targets > > > > I'm not sure if this document is correct for cases other than GUP. > > > >> */ > >> watermark =3D (order > PAGE_ALLOC_COSTLY_ORDER) ? > >> low_wmark_pages(zone) : min_wmark_pag= es(zone); > >> watermark +=3D compact_gap(order); > >> return __zone_watermark_ok(zone, 0, watermark, highest_zoneid= x, > >> - ALLOC_CMA, wmark_target); > >> + alloc_flags & ALLOC_CMA, wmark_targ= et); > >> } > >> > >> /* > >> * compaction_suitable: Is this suitable to run compaction on this z= one now? > >> */ > >> -bool compaction_suitable(struct zone *zone, int order, int highest_zo= neidx) > >> +bool compaction_suitable(struct zone *zone, int order, int highest_zo= neidx, > >> + unsigned int alloc_flags) > >> { > >> enum compact_result compact_result; > >> bool suitable; > >> > >> - suitable =3D __compaction_suitable(zone, order, highest_zoneid= x, > >> + suitable =3D __compaction_suitable(zone, order, highest_zoneid= x, alloc_flags, > >> zone_page_state(zone, NR_FRE= E_PAGES)); > >> /* > >> * fragmentation index determines if allocation failures are = due to > >> @@ -2474,7 +2476,7 @@ bool compaction_zonelist_suitable(struct alloc_c= ontext *ac, int order, > >> available =3D zone_reclaimable_pages(zone) / order; > >> available +=3D zone_page_state_snapshot(zone, NR_FREE= _PAGES); > >> if (__compaction_suitable(zone, order, ac->highest_zo= neidx, > >> - available)) > >> + alloc_flags, available)) > >> return true; > >> } > >> > >> @@ -2499,7 +2501,7 @@ compaction_suit_allocation_order(struct zone *zo= ne, unsigned int order, > >> alloc_flags)) > >> return COMPACT_SUCCESS; > >> > >> - if (!compaction_suitable(zone, order, highest_zoneidx)) > >> + if (!compaction_suitable(zone, order, highest_zoneidx, alloc_f= lags)) > >> return COMPACT_SKIPPED; > >> > >> return COMPACT_CONTINUE; > >> @@ -2893,6 +2895,7 @@ static int compact_node(pg_data_t *pgdat, bool p= roactive) > >> struct compact_control cc =3D { > >> .order =3D -1, > >> .mode =3D proactive ? MIGRATE_SYNC_LIGHT : MIGRATE_SY= NC, > >> + .alloc_flags =3D ALLOC_CMA, > >> .ignore_skip_hint =3D true, > >> .whole_zone =3D true, > >> .gfp_mask =3D GFP_KERNEL, > >> @@ -3037,7 +3040,7 @@ static bool kcompactd_node_suitable(pg_data_t *p= gdat) > >> > >> ret =3D compaction_suit_allocation_order(zone, > >> pgdat->kcompactd_max_order, > >> - highest_zoneidx, ALLOC_WMARK_MIN); > >> + highest_zoneidx, ALLOC_CMA | ALLOC_WMA= RK_MIN); > >> if (ret =3D=3D COMPACT_CONTINUE) > >> return true; > >> } > >> @@ -3058,6 +3061,7 @@ static void kcompactd_do_work(pg_data_t *pgdat) > >> .search_order =3D pgdat->kcompactd_max_order, > >> .highest_zoneidx =3D pgdat->kcompactd_highest_zoneidx= , > >> .mode =3D MIGRATE_SYNC_LIGHT, > >> + .alloc_flags =3D ALLOC_CMA | ALLOC_WMARK_MIN, > >> .ignore_skip_hint =3D false, > >> .gfp_mask =3D GFP_KERNEL, > >> }; > >> @@ -3078,7 +3082,7 @@ static void kcompactd_do_work(pg_data_t *pgdat) > >> continue; > >> > >> ret =3D compaction_suit_allocation_order(zone, > >> - cc.order, zoneid, ALLOC_WMARK_MIN); > >> + cc.order, zoneid, cc.alloc_flags); > >> if (ret !=3D COMPACT_CONTINUE) > >> continue; > >> > >> diff --git a/mm/internal.h b/mm/internal.h > >> index 3922788..6d257c8 100644 > >> --- a/mm/internal.h > >> +++ b/mm/internal.h > >> @@ -662,7 +662,8 @@ static inline void clear_zone_contiguous(struct zo= ne *zone) > >> zone->contiguous =3D false; > >> } > >> > >> -extern int __isolate_free_page(struct page *page, unsigned int order)= ; > >> +extern int __isolate_free_page(struct page *page, unsigned int order, > >> + unsigned int alloc_flags); > >> extern void __putback_isolated_page(struct page *page, unsigned int = order, > >> int mt); > >> extern void memblock_free_pages(struct page *page, unsigned long pfn= , > >> diff --git a/mm/page_alloc.c b/mm/page_alloc.c > >> index dde19db..1bfdca3 100644 > >> --- a/mm/page_alloc.c > >> +++ b/mm/page_alloc.c > >> @@ -2809,7 +2809,8 @@ void split_page(struct page *page, unsigned int = order) > >> } > >> EXPORT_SYMBOL_GPL(split_page); > >> > >> -int __isolate_free_page(struct page *page, unsigned int order) > >> +int __isolate_free_page(struct page *page, unsigned int order, > >> + unsigned int alloc_flags) > >> { > >> struct zone *zone =3D page_zone(page); > >> int mt =3D get_pageblock_migratetype(page); > >> @@ -2823,7 +2824,8 @@ int __isolate_free_page(struct page *page, unsig= ned int order) > >> * exists. > >> */ > >> watermark =3D zone->_watermark[WMARK_MIN] + (1UL << o= rder); > >> - if (!zone_watermark_ok(zone, 0, watermark, 0, ALLOC_CM= A)) > >> + if (!zone_watermark_ok(zone, 0, watermark, 0, > >> + alloc_flags & ALLOC_CMA)) > >> return 0; > >> } > >> > >> @@ -6454,6 +6456,7 @@ int alloc_contig_range_noprof(unsigned long star= t, unsigned long end, > >> .order =3D -1, > >> .zone =3D page_zone(pfn_to_page(start)), > >> .mode =3D MIGRATE_SYNC, > >> + .alloc_flags =3D ALLOC_CMA, > >> .ignore_skip_hint =3D true, > >> .no_set_skip_hint =3D true, > >> .alloc_contig =3D true, > >> diff --git a/mm/page_isolation.c b/mm/page_isolation.c > >> index c608e9d..a1f2c79 100644 > >> --- a/mm/page_isolation.c > >> +++ b/mm/page_isolation.c > >> @@ -229,7 +229,8 @@ static void unset_migratetype_isolate(struct page = *page, int migratetype) > >> buddy =3D find_buddy_page_pfn(page, page_to_p= fn(page), > >> order, NULL); > >> if (buddy && !is_migrate_isolate_page(buddy))= { > >> - isolated_page =3D !!__isolate_free_pag= e(page, order); > >> + isolated_page =3D !!__isolate_free_pag= e(page, order, > >> + ALLOC_CMA); > >> /* > >> * Isolating a free page in an isolat= ed pageblock > >> * is expected to always work as wate= rmarks don't > >> diff --git a/mm/page_reporting.c b/mm/page_reporting.c > >> index e4c428e..fd3813b 100644 > >> --- a/mm/page_reporting.c > >> +++ b/mm/page_reporting.c > >> @@ -198,7 +198,7 @@ page_reporting_cycle(struct page_reporting_dev_inf= o *prdev, struct zone *zone, > >> > >> /* Attempt to pull page from list and place in scatte= rlist */ > >> if (*offset) { > >> - if (!__isolate_free_page(page, order)) { > >> + if (!__isolate_free_page(page, order, ALLOC_CM= A)) { > >> next =3D page; > >> break; > >> } > >> diff --git a/mm/vmscan.c b/mm/vmscan.c > >> index 5e03a61..33f5b46 100644 > >> --- a/mm/vmscan.c > >> +++ b/mm/vmscan.c > >> @@ -5815,7 +5815,7 @@ static inline bool should_continue_reclaim(struc= t pglist_data *pgdat, > >> sc->reclaim_idx, 0)) > >> return false; > >> > >> - if (compaction_suitable(zone, sc->order, sc->reclaim_i= dx)) > >> + if (compaction_suitable(zone, sc->order, sc->reclaim_i= dx, ALLOC_CMA)) > >> return false; > >> } > >> > >> @@ -6043,7 +6043,7 @@ static inline bool compaction_ready(struct zone = *zone, struct scan_control *sc) > >> return true; > >> > >> /* Compaction cannot yet proceed. Do reclaim. */ > >> - if (!compaction_suitable(zone, sc->order, sc->reclaim_idx)) > >> + if (!compaction_suitable(zone, sc->order, sc->reclaim_idx, ALL= OC_CMA)) > >> return false; > >> > >> /* > >> -- > >> 2.7.4 > >> > >> > > > > Thanks > > Barry > >