Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7850493rwb; Wed, 23 Nov 2022 11:36:36 -0800 (PST) X-Google-Smtp-Source: AA0mqf4o0hty6ZXu3Chejd+YEFmXm46uO/mQ8sSkLcbZGgHkxfKRsYp+RfJHQxfAFHC2mWC4S8r5 X-Received: by 2002:a17:90a:ff84:b0:213:1e05:f992 with SMTP id hf4-20020a17090aff8400b002131e05f992mr10980862pjb.191.1669232196715; Wed, 23 Nov 2022 11:36:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669232196; cv=none; d=google.com; s=arc-20160816; b=ccCKxJM+Qn8axfpdg9kCriaUx/9Y9LjWKBZ6pPJuopu2CygcTFRmOg3L9EmOYuKMWW iCQnDuiqU8c3r38HK8CXRz8dM2aGpv0/o+ZJTsQFqHC56Pg/lWse5ZGN/KpSCK2gBx1p vKvmAUpl+4QrLlIrWU64+dG0RCd2uvAPchP/DfOpygDU5ILHCoi/NpqyIcQB1q7xYVvi GlP+fC/ZlGLOpkAhjuF/jbXgOp9WCrdLPJmfnTeNjpK8sITWbfOuK7xnnVgYRnC4MeVI UC1LhYrKLs2qnJIsQhdB8tyCV9SupC7gKuBKxWBKcjW10+naouQZinLsQ6vTtDxCEdt0 yeig== 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=ruO+YinHt02cD7LDLng29WAK5pZvQbCFBqvYCl3hrTY=; b=iQMcNnmLJUo4AJov8KIgk4PVQytbJFuco1gG+0Uni1GXgoXdUuZC1HuQHGUw5k/Swe wuh4+D8YSBWcAS9nQsPxgbbgZTqGLJ4k8znDV4/fSVNghg/uLfRvtEHIh743TvlgUPFQ f9H1lu+P3caG6hWVDOeKcjtpiNUn2TXdxCCqAMjda7FYv00knPeqsAB/TDN7uCznd9Zf VpOVeWFnjvrUat7eWccvrXJ2pDHqOGoz+VX956djdBuCGiTxz9/YgRPcnwrfaUyaVIb8 98OusuTRQBFdGITeGNQx5+ue4U99VKZaQa7WnGrPVlHWkUUjpZEl3rfs+5/khacGtjKm hqXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ixSC8hDn; 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 j13-20020a056a00174d00b0056dc342ea54si18269262pfc.206.2022.11.23.11.36.26; Wed, 23 Nov 2022 11:36:36 -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=ixSC8hDn; 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 S237702AbiKWTRh (ORCPT + 88 others); Wed, 23 Nov 2022 14:17:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239936AbiKWTRM (ORCPT ); Wed, 23 Nov 2022 14:17:12 -0500 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BF83C78FC for ; Wed, 23 Nov 2022 11:17:08 -0800 (PST) Received: by mail-pj1-x1032.google.com with SMTP id v3-20020a17090ac90300b00218441ac0f6so4320156pjt.0 for ; Wed, 23 Nov 2022 11:17:08 -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=ruO+YinHt02cD7LDLng29WAK5pZvQbCFBqvYCl3hrTY=; b=ixSC8hDnbztU0OC/soKUCSkVcuZpNhHZrTMy73xNCHzzfaOyQag8wcAC0zxDGxBQEL cFv7auDe3Fi4p541vWWnL5tcLNc4ebxoGg0/B1hK8LUhXQmzZgDYmUKupPy06uvdhq+u pZ/qgHC8iO7qPQHIiBSf2jxM95OSvjRzimzrdE/EZR2Fz8kS07wolWVCu7u8UnPTSxL/ 8f96Cj1m0EalvWOY5NWkL9XLuCj8AWz+EPKHmBSSQ4uS1ymXh/gwxuCrYA0BxUh72CNF w9kAwhEjdjC6kPN96wiobHFCgI++KuKuykXndt6lKhDz6zmY/05z3P/IVvnwBJCzZpMr yocA== 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=ruO+YinHt02cD7LDLng29WAK5pZvQbCFBqvYCl3hrTY=; b=K8Z3i6nwYPdnAU6SUJR1F0ZhjuQeGlnC/wwg9dzkU+QS8jYhf42SLt2/LglkpVgIii sVbGuEOtCTAGTdYbsAUjM0QBcuyanzWJGd4Vu6L/oakY2CoB/WkSYNFfj5mHF/d2ac3L kRc09nWYAT2UEexWkC55gdaHP1fa0j+r1YoMPLpf44i2wcaT2G4KUyXtnPGj0qpMuuvH ZGpX4NgUCaeUsk+39laH/xKDcQTIZtfbDsRRkSHbkJ9okO2PQazFF0ov7TSVbxdswZmk kCTr0dfFPvSYbrThfj++rRm1CN2Uq0WlJ2GNqN1sj/nH/zy8fJKre9ftzTNt8Cdm4U9o QPww== X-Gm-Message-State: ANoB5pmL5i2OKCEK9KS4jIWDu1PXE+tY25OOv/LtbCnNNJjUAqsU5eUg Z2MnfjWijKMhoazDBnBrkgc= X-Received: by 2002:a17:902:ab1d:b0:188:f5de:a8e4 with SMTP id ik29-20020a170902ab1d00b00188f5dea8e4mr11050853plb.133.1669231027538; Wed, 23 Nov 2022 11:17:07 -0800 (PST) Received: from localhost (fwdproxy-prn-020.fbsv.net. [2a03:2880:ff:14::face:b00c]) by smtp.gmail.com with ESMTPSA id a4-20020a170902ecc400b00180a7ff78ccsm14790814plh.126.2022.11.23.11.17.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Nov 2022 11:17:07 -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 v6 6/6] zsmalloc: Implement writeback mechanism for zsmalloc (fix) Date: Wed, 23 Nov 2022 11:17:03 -0800 Message-Id: <20221123191703.2902079-3-nphamcs@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221123191703.2902079-1-nphamcs@gmail.com> References: <20221123191703.2902079-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 Use get_first_page(), and add cond_resched() in retry loop. Signed-off-by: Nhat Pham Suggested-by: Sergey Senozhatsky --- mm/zsmalloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index e2bd41f37b5b..ab4fa17a0fad 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -2488,12 +2488,13 @@ static int zs_reclaim_page(struct zs_pool *pool, unsigned int retries) remove_zspage(class, zspage, fullness); spin_unlock(&pool->lock); + cond_resched(); /* Lock backing pages into place */ lock_zspage(zspage); obj_idx = 0; - page = zspage->first_page; + page = get_first_page(zspage); while (1) { handle = find_alloced_obj(class, page, &obj_idx); if (!handle) { -- 2.30.2