Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1013093rwb; Fri, 18 Nov 2022 11:19:05 -0800 (PST) X-Google-Smtp-Source: AA0mqf5635vkdiSeLd7GhIppalWCXJCIWWsR+vZuYynK3KbDGeXnON0HRvuGtgOrigYAI44OKKsZ X-Received: by 2002:a62:7b57:0:b0:56b:dd28:4f6e with SMTP id w84-20020a627b57000000b0056bdd284f6emr9542112pfc.0.1668799145458; Fri, 18 Nov 2022 11:19:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668799145; cv=none; d=google.com; s=arc-20160816; b=JEiDvpED0rnJMPa4L43jGhVwzTpcJM5KuvOo9khN4AVidnJDXwkoFwk3WwBZ+TuG1+ bcr0lPBp8HnW+W90XCvTixEs7/ARPdz/PVLAF9XjGqhtOQk+NNpZu9L774rBj4kZTM38 +ULb8k8D+j7yh7ZesiQsq3aB6NDc95w3+wnVq2H1Wccxpt8gt+HBUf1o8bixMlcbhlLB VnuizWkVcs3NE/5WXdNYHS3XL3a+e3rPqq7H4xU6y01rg3XPkLWufSQVY9WQqK55FDk5 Fi9BADDDJT/PK+pPqNumD+g8ZQqmm0ayZd9ZMFg7e3bs83EKExZTP/LzwpSXjNsMENIa oz+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=awQN/ZCJSxJ2Bey51fZL37YCVo4g2Qf+pzYIcGHdiWA=; b=i/yAPG5bjRAedup7Idpg/tUVI3jL0h2goFLfTw2gk8RcWAIFRB4/0YmXF4pG6Ed8Qq rK5t6zO+j0INVfD3R194YTUtmrpYpZ91eNTCzNiL0vooiieVzJPVjGpJ3CEHjdkUOK+E tLulaZbV/qAs1TfcX7z19R9aEk1P6GXgfjg4PG/HvNg/l1Bee1e3uq48BcZGmMiTpV1p Bk3sMmBOSVvMpUa5XGke5FC3bJyY3BFmDzb5odp+89JgNKfwFL4UgFYusIocm/5EJ0Qt 1e0uFK94yTHThHJeyMvHjpQJh3gKVS1Rn0smbkEtRm7d0BDRU4HKSiumbvUNUIP8ucw5 4M3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=XHyzobnK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w20-20020a63fb54000000b00461ffae7b37si4519643pgj.0.2022.11.18.11.18.53; Fri, 18 Nov 2022 11:19:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=XHyzobnK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242403AbiKRSZp (ORCPT + 90 others); Fri, 18 Nov 2022 13:25:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242726AbiKRSZM (ORCPT ); Fri, 18 Nov 2022 13:25:12 -0500 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D8539BA0A for ; Fri, 18 Nov 2022 10:24:16 -0800 (PST) Received: by mail-pl1-x629.google.com with SMTP id 4so5311045pli.0 for ; Fri, 18 Nov 2022 10:24:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=awQN/ZCJSxJ2Bey51fZL37YCVo4g2Qf+pzYIcGHdiWA=; b=XHyzobnKe+oOaTjXSZzBJ1qS4nD4Q+36AJReyTdqnyvQbIRh0qPu4d+50B1ntmMX1z 9D55pqnESb27MCIbC8engqlryb+LhkQQxOGgVxDN95uxG6ebO/zB9CHKuBZJhKT6IHYD Cksw1RnIxRkMOjeEWGKU6N/jv0/d8f8ZQC+ZzdTSF29Ols5t9pxDZe4VFtM2b0IdL1WF YdqOBimS4bedY5ugdRKIB+KWN4OeGWgdORHmG5y/niC+nJmS59fujKKFpWTEtrmiGarj Whfn9Z69Q1Glv6N29+tbeWYSEy5RSTwZz5mg7pNQRE5xmfmayOptcVZzZ2uDdPNEX5pc 10uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=awQN/ZCJSxJ2Bey51fZL37YCVo4g2Qf+pzYIcGHdiWA=; b=phPJgjquYmRxinlA8XUU2+l+2jarYalLnYhWpdzosz3p7hem7vKv8x81m2sN3aHy9T WSo0jW8jtM9yDj8CPLD3BNg/rQausvJZCxoCeTpy9mcvLoZjxWrTbYZ8trdjKzRLXVI9 2U80f/p2BTh2/DkDYo8aSaMLmxDyeG6hVzSfpcjV/cH738vSjjoYU4WQ8HOFynxDxYU8 SI0wguSPtMySD9safm6lHKtMRd+SySfZ8RjIPVyPZNUBd0Othxa83eAmGO99Ghq8HEVn A3YGrLh+QRph3GE2zKn3LBXNHaplAO4EELsnubtLZmc3Mym3m01CK/uAl+L967oqqzaz zzbA== X-Gm-Message-State: ANoB5pldUphs9pfTok7Nd7Ky+UMVScai9E/hhPx3UYg+xnCia3/bXhV+ d2BPSBIVrPZM5MIIy2P8T2z7Iz8oPtmWqQ== X-Received: by 2002:a17:902:b613:b0:188:f570:7bd6 with SMTP id b19-20020a170902b61300b00188f5707bd6mr692050pls.97.1668795855932; Fri, 18 Nov 2022 10:24:15 -0800 (PST) Received: from localhost (fwdproxy-prn-011.fbsv.net. [2a03:2880:ff:b::face:b00c]) by smtp.gmail.com with ESMTPSA id a16-20020a170902ecd000b0017f49b41c12sm4051234plh.173.2022.11.18.10.24.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 10:24:15 -0800 (PST) From: Nhat Pham To: akpm@linux-foundation.org Cc: hannes@cmpxchg.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, minchan@kernel.org, ngupta@vflare.org, senozhatsky@chromium.org, sjenning@redhat.com, ddstreet@ieee.org, vitaly.wool@konsulko.com Subject: [PATCH v5 5/6] zsmalloc: Add zpool_ops field to zs_pool to store evict handlers Date: Fri, 18 Nov 2022 10:24:06 -0800 Message-Id: <20221118182407.82548-6-nphamcs@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221118182407.82548-1-nphamcs@gmail.com> References: <20221118182407.82548-1-nphamcs@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds a new field to zs_pool to store evict handlers for writeback, analogous to the zbud allocator. Signed-off-by: Nhat Pham --- mm/zsmalloc.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 9e7b54324181..3ff86f57d08c 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -242,6 +242,8 @@ struct zs_pool { #ifdef CONFIG_ZPOOL /* List tracking the zspages in LRU order by most recently added object */ struct list_head lru; + struct zpool *zpool; + const struct zpool_ops *zpool_ops; #endif #ifdef CONFIG_ZSMALLOC_STAT @@ -394,7 +396,14 @@ static void *zs_zpool_create(const char *name, gfp_t gfp, * different contexts and its caller must provide a valid * gfp mask. */ - return zs_create_pool(name); + struct zs_pool *pool = zs_create_pool(name); + + if (pool) { + pool->zpool = zpool; + pool->zpool_ops = zpool_ops; + } + + return pool; } static void zs_zpool_destroy(void *pool) -- 2.30.2