From patchwork Fri Nov 18 18:24:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nhat Pham X-Patchwork-Id: 22439 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp350581wrr; Fri, 18 Nov 2022 10:39:04 -0800 (PST) X-Google-Smtp-Source: AA0mqf7fRknrI7+MK7L79vr2FZOSOrlJ8z1atcqs7FPmwUes2lK2Hlh42J2flYk70piQgApUyHdO X-Received: by 2002:a17:90a:5911:b0:218:7b32:d353 with SMTP id k17-20020a17090a591100b002187b32d353mr7118266pji.100.1668796743816; Fri, 18 Nov 2022 10:39:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668796743; cv=none; d=google.com; s=arc-20160816; b=MwqpHV5bJhUoJ6XZBc5+kG38qNhCptZAusdhzo9ENvNSekGrZQuJ6vNociYuMpLi/1 hU5wMfsMwSZLY38wv935pYUzQGQcUJmY0nNRX3Od6qldBZ+Z5P/2f2xjfwTFEdQFgSXJ LHq48Re0ncSSVqAB903XFhitNSgrLH8LmnxzP2hTqMoYAtGVhwjea0psjru9F+FpeV/C +zLhaKdsO/2eeB3x+WQI1XjLgQqr0KlEtyvjr3Njw7QPUI0w5v6da+KY94FC6hL20zcX n0OwsW/UoOjUBtlHsBznKo8x7xRxwHVKtMj7Wd1yK0Wz4rG+lFHI08g0loW/5NCndwIk mVrw== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w1-20020a636201000000b0043c0b4f2b68si4307348pgb.318.2022.11.18.10.38.49; Fri, 18 Nov 2022 10:39:03 -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 + 99 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749860214823946746?= X-GMAIL-MSGID: =?utf-8?q?1749860214823946746?= This adds a new field to zs_pool to store evict handlers for writeback, analogous to the zbud allocator. Signed-off-by: Nhat Pham Acked-by: Minchan Kim --- mm/zsmalloc.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) -- 2.30.2 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)