From patchwork Thu Dec 19 14:26:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vitaly Wool X-Patchwork-Id: 11303723 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 08392138C for ; Thu, 19 Dec 2019 14:26:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C872E24672 for ; Thu, 19 Dec 2019 14:26:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UG2Rag9z" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C872E24672 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 0E98C8E0174; Thu, 19 Dec 2019 09:26:12 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 0C1888E00F5; Thu, 19 Dec 2019 09:26:12 -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 F3FEE8E0174; Thu, 19 Dec 2019 09:26:11 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0077.hostedemail.com [216.40.44.77]) by kanga.kvack.org (Postfix) with ESMTP id DE1228E00F5 for ; Thu, 19 Dec 2019 09:26:11 -0500 (EST) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id 5D28D824999B for ; Thu, 19 Dec 2019 14:26:11 +0000 (UTC) X-FDA: 76282115742.06.cow63_5312da1685e51 X-Spam-Summary: 2,0,0,adcfffdf27f03a7f,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:3867:4250:4321:5007:6261:6642:6653: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:21990:30054,0,RBL:209.85.208.194:@gmail.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.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:25,LUA_SUMMARY:none X-HE-Tag: cow63_5312da1685e51 X-Filterd-Recvd-Size: 4694 Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) by imf05.hostedemail.com (Postfix) with ESMTP for ; Thu, 19 Dec 2019 14:26:10 +0000 (UTC) Received: by mail-lj1-f194.google.com with SMTP id u1so6435714ljk.7 for ; Thu, 19 Dec 2019 06:26:10 -0800 (PST) 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=eYZf2PAZk6wJlce5o8wLQfqz+k895+yefprdeiTmKqI=; b=UG2Rag9zPQHoaQ48g84ISujxsEL3CqlKjU167VCafzjKPq2OPtDP05/RKbX+aRaJBK APiv1iiZcjwGZTm+NVk2vrUzQ4YLNxb5rMznUGV+krOQdXLjZ+xUj0LUN8C/AUaSkfJ3 lKeKpUPFNJN/pzwh3MvnV8mzR6XmKkuniKawcKtmCnvylPrt2Yzs9S77wwzQ27mWXdb+ yl0i6MMzFQhg4sNQRHJoK1h9nMrKUVF+TPIOPDbJ1r7M8eShQkbnae0/lES/OdBvjIFS 08z2nH846N9EuofyWjdcAX1QLeqdAosv8iJQhcW6cE5fBFcLg1qw6mIPCZOV0WMK+wk/ P2Vw== 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=eYZf2PAZk6wJlce5o8wLQfqz+k895+yefprdeiTmKqI=; b=olviMXlHxnSQS+ykeBzVa8pEzCdXpqJOE7hoTZwYmQw3jMN4TVON3ukNyzpvFUfZ3Z HDI6YvHb+7nyk7PLGZskymetsKYbXbbeqr4o1GojuKMJt3TliNnyXs5CqkLXCO1k0aZX z7DnZOhXqyfaXoOUxIWBNVZHDgqlTJwL9rjHg/YF/vnSFUplJr71lwQvKAmkDL/umVW8 tkoYE2KpcLwSfTY0WX7j33/t0uSa50+4CEchPt0VwlNjP70E7Bx5gImLq9U8WiHDLQGb 4HiVOUT+K9zUyAbYkqDjRuc8yeSL703xEJ1ZVduk0ARRT+khG4e6QkAT+HJ5Ss+M8fUQ iM/A== X-Gm-Message-State: APjAAAXEuASJ7PZ2UqL1qe+qDAli/AqdZlS0LxsiQDd9Xi8ufzaZE/Gj Xxvj1d7wh1Id71KidTlteWdUqlrtuCvhng== X-Google-Smtp-Source: APXvYqwoDSKjOq8wwxmkSZnXq/HfNtdJzzk7qU8k6Ew6E7DXu96p7VMBGYDJB60KDr7YWng8euHmIA== X-Received: by 2002:a2e:800b:: with SMTP id j11mr5690943ljg.126.1576765569240; Thu, 19 Dec 2019 06:26:09 -0800 (PST) Received: from assa ([109.252.14.238]) by smtp.gmail.com with ESMTPSA id y1sm611437ljm.12.2019.12.19.06.26.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2019 06:26:08 -0800 (PST) Date: Thu, 19 Dec 2019 15:26:07 +0100 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: [PATCHv2 2/3] zsmalloc: add compaction and huge class callbacks Message-Id: <20191219152607.03b458b910625d95f388f4d1@gmail.com> In-Reply-To: <20191219151928.ad4ccf732b64b7f8a26116db@gmail.com> References: <20191219151928.ad4ccf732b64b7f8a26116db@gmail.com> X-Mailer: Sylpheed 3.7.0 (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. 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");