From patchwork Thu Oct 10 20:11:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vitaly Wool X-Patchwork-Id: 11184171 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 D04B617D4 for ; Thu, 10 Oct 2019 20:11:48 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8FB26214E0 for ; Thu, 10 Oct 2019 20:11:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AMPzRcMz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8FB26214E0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B8DCE8E0005; Thu, 10 Oct 2019 16:11:47 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id B3DBF8E0003; Thu, 10 Oct 2019 16:11:47 -0400 (EDT) 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 A53458E0005; Thu, 10 Oct 2019 16:11:47 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0218.hostedemail.com [216.40.44.218]) by kanga.kvack.org (Postfix) with ESMTP id 854FD8E0003 for ; Thu, 10 Oct 2019 16:11:47 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id 3092182437C9 for ; Thu, 10 Oct 2019 20:11:47 +0000 (UTC) X-FDA: 76028970654.29.view28_2ca145453724b X-Spam-Summary: 75,0,0,8bf8bead4e550617,d41d8cd98f00b204,vitalywool@gmail.com,::akpm@linux-foundation.org:ddstreet@ieee.org:minchan@kernel.org:sergey.senozhatsky.work@gmail.com:linux-kernel@vger.kernel.org:vbabka@suse.cz:shakeelb@google.com:henrywolfeburns@gmail.com:tytso@thunk.org,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3352:3369:3865:3867:3870:4250:4321:5007:6261:6653:7514:9413:10004:10400:11026:11658:11914:12043:12048:12291:12296:12297:12438:12517:12519:12555:12760:12895:12986:13069:13311:13357:13439:14096:14097:14181:14394:14659:14687:14721:21080:21212:21444:21451:21627:21666:30054,0,RBL:209.85.208.195-irl.urbl.hostedemail.com-127.0.0.175,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:25,LUA_SUMMARY:none X-HE-Tag: view28_2ca145453724b X-Filterd-Recvd-Size: 4851 Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by imf27.hostedemail.com (Postfix) with ESMTP for ; Thu, 10 Oct 2019 20:11:46 +0000 (UTC) Received: by mail-lj1-f195.google.com with SMTP id l21so7529827lje.4 for ; Thu, 10 Oct 2019 13:11:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QJWOGN1T52H0uvWMZ9lrHPVpqM+o1MdQipUB8ycg4N0=; b=AMPzRcMzP0Q+ZRjBMDxm6q1DmMC6OYTMxAQ3EOwa/E47MuDYSz2TtMCOR2T/COr3eU EuHk30dqlS5g9nWsWRCUTKpuO9evJY5KqKWYfnevUFz2iEQHIL6QQ33AjYfU6yl/EA3N 8bCaMqIE66VwOapMYxDbhgwUshFNpesAOP8teGjM3JHZB2MQJtNP3si1uzA+taJLCcu3 5rn7t9yzAgoPSxXQgZN3T2RSou9+hGP9BfUhQzaxACPi+hnL8FofC4Gz2ebJ7VCBLySZ sQkByQJs/3CdOoJz/8rTfekiYBySlvQ39Qi+M8yNfpkTFepUFIe2I1ME5BT7LRvFlPHJ 7Xlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QJWOGN1T52H0uvWMZ9lrHPVpqM+o1MdQipUB8ycg4N0=; b=ULMZnGHAte7XtFIpw84F2wUG/kHZ2lQqQ4Ez6+s1/mvl+FG1AXZVDvG9TkT3ffmN35 NSUZia351ZNU29ISYphk2kynah+ZnriNsPe0wnjM8PijupDhRLyfpvozA0h+kpYx+I97 K6w0hI7j77pVDL+mznsDUS0hQ3+EkQM5bNY5cOmjKb5mQGKdpNIzZ+Zi6j3VG65o4me8 +/JkfISkOiXGsxYxjJDVj5jvWGDG+85IViDa1w0l9h0aGtjor79IvXnpDlVFGPoltFPf ZQVMd55sv6ygqcONUchI9+i3+3fjFpkebWrOjM42wYAvaWPaFVNzExIwPYyAOfHtt8KI zTeQ== X-Gm-Message-State: APjAAAX/nSDmRA9pd0V5TUvXPxrEvSddW/2yo21tuM9UBVBh9CPdg4P9 C2sCPUtG0l11UVllenylfayA/PvXTIJaXA== X-Google-Smtp-Source: APXvYqzN+Eo38GYZjgQvgyjVNpEmWykAfXX1SXTS5NplM6jQi15Q1eur5GZoG7DxYI04DSCojiWjxw== X-Received: by 2002:a2e:3014:: with SMTP id w20mr7572909ljw.115.1570738304765; Thu, 10 Oct 2019 13:11:44 -0700 (PDT) Received: from vitaly-Dell-System-XPS-L322X (c188-150-241-161.bredband.comhem.se. [188.150.241.161]) by smtp.gmail.com with ESMTPSA id o13sm1457581lji.31.2019.10.10.13.11.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 13:11:44 -0700 (PDT) Date: Thu, 10 Oct 2019 23:11:43 +0300 From: Vitaly Wool To: Linux-MM , Andrew Morton , Dan Streetman , Minchan Kim Cc: Sergey Senozhatsky , LKML , Vlastimil Babka , Shakeel Butt , Henry Burns , Theodore Ts'o Subject: [PATCH 2/3] zsmalloc: add compaction and huge class callbacks Message-Id: <20191010231143.09e4a2bd52f331efd0c4baf9@gmail.com> In-Reply-To: <20191010230414.647c29f34665ca26103879c4@gmail.com> References: <20191010230414.647c29f34665ca26103879c4@gmail.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 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: Add compaction callbacks for zpool compaction API extension. Add huge_class_size callback too to be fully aligned. With these in place, we can proceed with ZRAM modification to use the universal (zpool) API. Signed-off-by: Vitaly Wool --- mm/zsmalloc.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 2b2b9aae8a3c..43f43272b998 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -437,11 +437,29 @@ static void zs_zpool_unmap(void *pool, unsigned long handle) zs_unmap_object(pool, handle); } +static unsigned long zs_zpool_compact(void *pool) +{ + return zs_compact(pool); +} + +static unsigned long zs_zpool_get_compacted(void *pool) +{ + struct zs_pool_stats stats; + + zs_pool_stats(pool, &stats); + return stats.pages_compacted; +} + static u64 zs_zpool_total_size(void *pool) { return zs_get_total_pages(pool) << PAGE_SHIFT; } +static size_t zs_zpool_huge_class_size(void *pool) +{ + return zs_huge_class_size(pool); +} + static struct zpool_driver zs_zpool_driver = { .type = "zsmalloc", .owner = THIS_MODULE, @@ -453,6 +471,9 @@ static struct zpool_driver zs_zpool_driver = { .map = zs_zpool_map, .unmap = zs_zpool_unmap, .total_size = zs_zpool_total_size, + .compact = zs_zpool_compact, + .get_num_compacted = zs_zpool_get_compacted, + .huge_class_size = zs_zpool_huge_class_size, }; MODULE_ALIAS("zpool-zsmalloc");