From patchwork Mon Nov 2 14:39:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Goldsworthy X-Patchwork-Id: 11874053 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1485D921 for ; Mon, 2 Nov 2020 14:40:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C68CE2072C for ; Mon, 2 Nov 2020 14:40:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="EH4c/NTA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C68CE2072C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E5E526B007B; Mon, 2 Nov 2020 09:40:47 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E0EAB6B007D; Mon, 2 Nov 2020 09:40:47 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C6B5E6B007E; Mon, 2 Nov 2020 09:40:47 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0102.hostedemail.com [216.40.44.102]) by kanga.kvack.org (Postfix) with ESMTP id 832566B007B for ; Mon, 2 Nov 2020 09:40:47 -0500 (EST) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 1469A8249980 for ; Mon, 2 Nov 2020 14:40:47 +0000 (UTC) X-FDA: 77439739734.09.linen61_33001f7272b0 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin09.hostedemail.com (Postfix) with ESMTP id E8C53180AD806 for ; Mon, 2 Nov 2020 14:40:46 +0000 (UTC) X-Spam-Summary: 1,0,0,ded647f339139878,d41d8cd98f00b204,bounce+d06763.be9e4a-linux-mm=kvack.org@mg.codeaurora.org,,RULES_HIT:41:355:379:541:800:960:966:973:988:989:1260:1345:1359:1437:1535:1542:1711:1730:1747:1777:1792:2196:2198:2199:2200:2393:2559:2562:2731:3138:3139:3140:3141:3142:3353:3865:3866:3867:3870:3871:4250:4321:4385:4605:5007:6119:6261:6653:7576:7974:10004:11026:11218:11232:11473:11658:11914:12043:12048:12296:12297:12438:12517:12519:12555:12679:12986:13161:13229:14181:14394:14721:21080:21325:21451:21627:21972:21990:22119:30012:30054,0,RBL:104.130.96.5:@mg.codeaurora.org:.lbl8.mailshell.net-62.2.0.100 64.100.201.201;04ygs5qish5f54o4o8qcpzztg1dy7ycaw3m8ac68ex6tejae6fgcnrp77eowp9b.5apxd3fozfw9m7a4hktuiccxaskuyh3x6o4fgfe6u1hd9a51uysmr78n4rdq3pe.r-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:112,LUA_SUMMARY:none X-HE-Tag: linen61_33001f7272b0 X-Filterd-Recvd-Size: 5350 Received: from z5.mailgun.us (z5.mailgun.us [104.130.96.5]) by imf06.hostedemail.com (Postfix) with ESMTP for ; Mon, 2 Nov 2020 14:40:42 +0000 (UTC) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1604328046; h=References: In-Reply-To: References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=snwxvlRE7nLYTeaBPML9K64AgFTva8Hm58yvYVS5uW4=; b=EH4c/NTAkA5hrsHGHmUJbEOWrmMDoTuedDrEiObt0JOn0bYggnOWQM895I3BK53u8/MrHZr9 Rjww6hxKrgTvCo/oSBotLuaR3xvnS+BYGnFaNJClrN32R1nnmE/u6Es6OF2tOYqmoBziYRyZ 22wIGV+oWaAToQ2UhI908FoFHN0= X-Mailgun-Sending-Ip: 104.130.96.5 X-Mailgun-Sid: WyIwY2Q3OCIsICJsaW51eC1tbUBrdmFjay5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n05.prod.us-east-1.postgun.com with SMTP id 5fa01a567b1a71d6684169f9 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 02 Nov 2020 14:40:22 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 3FA84C433C9; Mon, 2 Nov 2020 14:40:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL autolearn=no autolearn_force=no version=3.4.0 Received: from cgoldswo-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: cgoldswo) by smtp.codeaurora.org (Postfix) with ESMTPSA id 2714EC433C6; Mon, 2 Nov 2020 14:40:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 2714EC433C6 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=cgoldswo@codeaurora.org From: Chris Goldsworthy To: Andrew Morton , Minchan Kim , Nitin Gupta , Sergey Senozhatsky Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Vinayak Menon , Chris Goldsworthy Subject: [PATCH 2/2] zram: allow zram to allocate CMA pages Date: Mon, 2 Nov 2020 06:39:22 -0800 Message-Id: <4c77bb100706b714213ff840d827a48e40ac9177.1604282969.git.cgoldswo@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: 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: From: Vinayak Menon Though zram pages are movable, they aren't allowed to enter MIGRATE_CMA pageblocks. zram is not seen to pin pages for long which can cause an issue. Moreover allowing zram to pick CMA pages can be helpful in cases seen where zram order 0 alloc fails when there are lots of free cma pages, resulting in kswapd or direct reclaim not making enough progress. Signed-off-by: Vinayak Menon Signed-off-by: Chris Goldsworthy --- drivers/block/zram/zram_drv.c | 5 +++-- mm/zsmalloc.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 9a1e6ee..4b6b16d 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -1380,13 +1380,14 @@ static int __zram_bvec_write(struct zram *zram, struct bio_vec *bvec, __GFP_KSWAPD_RECLAIM | __GFP_NOWARN | __GFP_HIGHMEM | - __GFP_MOVABLE); + __GFP_MOVABLE | + __GFP_CMA); if (!handle) { zcomp_stream_put(zram->comp); atomic64_inc(&zram->stats.writestall); handle = zs_malloc(zram->mem_pool, comp_len, GFP_NOIO | __GFP_HIGHMEM | - __GFP_MOVABLE); + __GFP_MOVABLE | __GFP_CMA); if (handle) goto compress_again; return -ENOMEM; diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index b03bee2..16ba318 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -351,7 +351,7 @@ static void destroy_cache(struct zs_pool *pool) static unsigned long cache_alloc_handle(struct zs_pool *pool, gfp_t gfp) { return (unsigned long)kmem_cache_alloc(pool->handle_cachep, - gfp & ~(__GFP_HIGHMEM|__GFP_MOVABLE)); + gfp & ~(__GFP_HIGHMEM|__GFP_MOVABLE|__GFP_CMA)); } static void cache_free_handle(struct zs_pool *pool, unsigned long handle) @@ -362,7 +362,7 @@ static void cache_free_handle(struct zs_pool *pool, unsigned long handle) static struct zspage *cache_alloc_zspage(struct zs_pool *pool, gfp_t flags) { return kmem_cache_alloc(pool->zspage_cachep, - flags & ~(__GFP_HIGHMEM|__GFP_MOVABLE)); + flags & ~(__GFP_HIGHMEM|__GFP_MOVABLE|__GFP_CMA)); } static void cache_free_zspage(struct zs_pool *pool, struct zspage *zspage)