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 X-Spam-Level: X-Spam-Status: No, score=-11.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC8C1C4727F for ; Tue, 29 Sep 2020 09:53:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 51107208FE for ; Tue, 29 Sep 2020 09:53:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=suse.com header.i=@suse.com header.b="FgrE8IX2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 51107208FE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3E0CA6B005C; Tue, 29 Sep 2020 05:53:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 392C16B005D; Tue, 29 Sep 2020 05:53:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 25BF78E0001; Tue, 29 Sep 2020 05:53:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0047.hostedemail.com [216.40.44.47]) by kanga.kvack.org (Postfix) with ESMTP id 10EBE6B005C for ; Tue, 29 Sep 2020 05:53:25 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id BEA2F8249980 for ; Tue, 29 Sep 2020 09:53:24 +0000 (UTC) X-FDA: 77315636328.30.car13_26051a627189 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id 9A602180B3C83 for ; Tue, 29 Sep 2020 09:53:24 +0000 (UTC) X-HE-Tag: car13_26051a627189 X-Filterd-Recvd-Size: 5249 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Tue, 29 Sep 2020 09:53:23 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1601373203; h=from:from: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; bh=il8OjVwDlFOXLr6gKoOMtVUBESGFP/mYXQMYTFLTgy0=; b=FgrE8IX2EUa3cIXAIigwejv5YTcWAFYL9R6bdUEPDzYI8Pf5+aAhr0APlKW0XLYFWgWZB8 jxcbhMVQvBI4j9++8ywgL2eyk9ihUgt0moq936nqGdOtANVkjzZn5YZj1hX49DZ2dodVex uFbL0fSMIKWk9E38xmJYBOPWtLTjUQQ= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id E7B08AD2E; Tue, 29 Sep 2020 09:53:22 +0000 (UTC) Date: Tue, 29 Sep 2020 11:53:18 +0200 From: Michal Hocko To: Joonsoo Kim Cc: Andrew Morton , Linux Memory Management List , LKML , Vlastimil Babka , "Aneesh Kumar K . V" , Mel Gorman , kernel-team@lge.com, Joonsoo Kim Subject: Re: [PATCH v2 for v5.9] mm/page_alloc: handle a missing case for memalloc_nocma_{save/restore} APIs Message-ID: <20200929095318.GA2277@dhcp22.suse.cz> References: <1601283046-15329-1-git-send-email-iamjoonsoo.kim@lge.com> <20200929080814.GB22035@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue 29-09-20 17:38:43, Joonsoo Kim wrote: > 2020=EB=85=84 9=EC=9B=94 29=EC=9D=BC (=ED=99=94) =EC=98=A4=ED=9B=84 5:0= 8, Michal Hocko =EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84=B1: > > > > On Mon 28-09-20 17:50:46, Joonsoo Kim wrote: > > > From: Joonsoo Kim > > > > > > memalloc_nocma_{save/restore} APIs can be used to skip page allocat= ion > > > on CMA area, but, there is a missing case and the page on CMA area = could > > > be allocated even if APIs are used. This patch handles this case to= fix > > > the potential issue. > > > > > > Missing case is an allocation from the pcplist. MIGRATE_MOVABLE pcp= list > > > could have the pages on CMA area so we need to skip it if ALLOC_CMA= isn't > > > specified. > > > > > > Fixes: 8510e69c8efe (mm/page_alloc: fix memalloc_nocma_{save/restor= e} APIs) > > > Signed-off-by: Joonsoo Kim > > > --- > > > mm/page_alloc.c | 13 ++++++++++--- > > > 1 file changed, 10 insertions(+), 3 deletions(-) > > > > > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > > > index fab5e97..104d2e1 100644 > > > --- a/mm/page_alloc.c > > > +++ b/mm/page_alloc.c > > > @@ -3367,9 +3367,16 @@ struct page *rmqueue(struct zone *preferred_= zone, > > > struct page *page; > > > > > > if (likely(order =3D=3D 0)) { > > > - page =3D rmqueue_pcplist(preferred_zone, zone, gfp_fl= ags, > > > + /* > > > + * MIGRATE_MOVABLE pcplist could have the pages on CM= A area and > > > + * we need to skip it when CMA area isn't allowed. > > > + */ > > > + if (!IS_ENABLED(CONFIG_CMA) || alloc_flags & ALLOC_CM= A || > > > + migratetype !=3D MIGRATE_MOVABLE) { > > > + page =3D rmqueue_pcplist(preferred_zone, zone= , gfp_flags, > > > migratetype, alloc_flags); > > > - goto out; > > > + goto out; > > > + } > > > } > > > > This approach looks definitely better than the previous version. >=20 > Thanks! >=20 > > > > > > /* > > > @@ -3381,7 +3388,7 @@ struct page *rmqueue(struct zone *preferred_z= one, > > > > > > do { > > > page =3D NULL; > > > - if (alloc_flags & ALLOC_HARDER) { > > > + if (order > 0 && alloc_flags & ALLOC_HARDER) { > > > page =3D __rmqueue_smallest(zone, order, MIGR= ATE_HIGHATOMIC); > > > if (page) > > > trace_mm_page_alloc_zone_locked(page,= order, migratetype); > > > > But this condition is not clear to me. __rmqueue_smallest doesn't acc= ess > > pcp lists. Maybe I have missed the point in the original discussion b= ut > > this deserves a comment at least. >=20 > Before the pcplist skipping is applied, order-0 request can not reach h= ere. > But, now, an order-0 request can reach here. Free memory on > MIGRATE_HIGHATOMIC is reserved for high-order atomic allocation > so an order-0 request should skip it. OK, I see. Thanks for the clarification. > I will add a code comment on the next version. Thanks, that would be indeed helpful. With that, feel free to add Acked-by: Michal Hocko --=20 Michal Hocko SUSE Labs