From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D681C47DD9 for ; Wed, 28 Feb 2024 06:44:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9E49A6B0290; Wed, 28 Feb 2024 01:44:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 96CFC6B0291; Wed, 28 Feb 2024 01:44:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7E64A6B0292; Wed, 28 Feb 2024 01:44:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 6A4506B0290 for ; Wed, 28 Feb 2024 01:44:25 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id ECDA91A0E48 for ; Wed, 28 Feb 2024 06:44:24 +0000 (UTC) X-FDA: 81840273648.19.AD5C868 Received: from out-177.mta1.migadu.com (out-177.mta1.migadu.com [95.215.58.177]) by imf29.hostedemail.com (Postfix) with ESMTP id 0107B120008 for ; Wed, 28 Feb 2024 06:44:22 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=uDUJ6vts; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf29.hostedemail.com: domain of chengming.zhou@linux.dev designates 95.215.58.177 as permitted sender) smtp.mailfrom=chengming.zhou@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709102663; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=mDw5AbPTFhldWRncX473mReQMJoUYqgYBgyYIvyTquk=; b=QImDpqVzTyaVYzB2GeESWdIlBawYUa+rOMbQW7BH/MAde9P81ZIFFraIgIJrvc+HmghsuW bdYUjfuhusPnvU3BC5S8Ooy/oC2puPogNXCydJ/Ii8clfagSKC0fDie2BskOeoyr6/QCNk hfb8NSS0NzMdqzyJSWRwAx4pTn/OuIc= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=uDUJ6vts; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf29.hostedemail.com: domain of chengming.zhou@linux.dev designates 95.215.58.177 as permitted sender) smtp.mailfrom=chengming.zhou@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709102663; a=rsa-sha256; cv=none; b=bsEh2jro4ekM1Zt9N7nddp057sSZx2m/rmzd3Y22/nK7vVOvQZXKnZ2oOHIrfd0now90Nj XHDhEQsDV92LF9hr50itdxvsCdSns3pvC7kv/5V9SAch/dZmzciKSTfeWRtGpxDoK9Lzm+ xo+3jQWOJJ0Mv/uYDur7c85er0v9NxI= Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1709102660; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mDw5AbPTFhldWRncX473mReQMJoUYqgYBgyYIvyTquk=; b=uDUJ6vtsCZLEtFibLEIP8BQ26/lnZ5LbvVahVBolUFrnAoq2E/C2cplUVj5eF5ZnjAJfKp 99KP8bMjTsc2FlUIdSumDFB1BhlM6BfC+5oeDdPuCeELrB3IzPBaM+mQWU+KAZs2xAnYMk WJ2ee2mPti3LBzWs0QPe8JPf7z60wxc= Date: Wed, 28 Feb 2024 14:44:13 +0800 MIME-Version: 1.0 Subject: Re: [PATCH 1/2] mm/zsmalloc: don't hold locks of all pages when free_zspage() Content-Language: en-US To: Sergey Senozhatsky Cc: yosryahmed@google.com, hannes@cmpxchg.org, nphamcs@gmail.com, Andrew Morton , Minchan Kim , linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <20240226-zsmalloc-zspage-rcu-v1-0-456b0ef1a89d@bytedance.com> <20240226-zsmalloc-zspage-rcu-v1-1-456b0ef1a89d@bytedance.com> <20240228060113.GJ11972@google.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Chengming Zhou In-Reply-To: <20240228060113.GJ11972@google.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: 0107B120008 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: yw1tkptiw4qoziuehda5roskia3kifng X-HE-Tag: 1709102662-161460 X-HE-Meta: U2FsdGVkX1+/43UWruap3DwkIvauXAAyEMQE7C0y0pbBgN4JR1J0ZKY2gio4g6BGnRf03/Mi6jknFGZ2JGGVQwfK8pfUDkNgzGects4vzlVUk84i+rtrCmZpFyPWpeRagw3BrL4WSjIWEFHHmgavUKRlfEoGxZ9CHKV3zlPODnO14l5qbUVzzDabdc4fS/C1k6xlJ3vi+vljKl5LUjiOIIm92jmWuTuOVLYDPs3aTMfwdfhgvTPHMNTx/8JHmh1MxNT00uyaDo5yLwoc8go78ytgILDHcv1gQ3UIAv1PVgWhMlq7O6a/WpbxC/qXiTtIAn8hqxY3CIPns0SLkFXcWovz7ej3Wm3DhH0pRgaAS25TA9L4a/AM+vEHfshtTsw1Ru7e2DBW23jkNvSpQadkXcvdIl1+apYcmQirPixbyALdyx2p2b0rQmvLqFOpY4Xz+HOJGpvg8Y8sca/iboyxLInvPSehTJODOQrbioZ2OF+XtC9NrPmq3qe/pEYiywikuiV4nmRo0YbFi72wbGyICapZx03lSbjskKufOSdeA6DwnmdqP4pFBtm1WNEBirLYGDp4Vyd7cxgfJ9RNWNTAaKggtT4P/rEha1chWyV5IwiLj0oRDJs9SFDJiv1AvIj+hJyP0DBi7Srq0c5RBxWkEtvzYLUlUvpzsiLIzPHdIwDKGhSFwc7HiQHsaAKOa+9jdIcHkAZOlw9POrJslFadZB51/r/+WIzEQXmC31GkcVeYgyjeCOSlURAUMjTzVGfPEWKtsl9yLBYNTIqdMVNEjzMPG2RrWaay96ziJ+aGHItc2R0RBCRntNcaQ2okJURyuHSC038t/8ayuH2n9c5GdDHamMhSGZuUbBmL4K7pI/mX+D5IA2CWtbywOTiJ1bD6YTkNyIuTPTvxfE8hOiKI4HQI39GbfUc9t7Jnns685YZ8XIixWvVHh1Bp0G3OXDVUIG7AJZ2EzsBvUkVjD/6 EVZYHLpu BFMuI8WTCJpVqDJWyvSTkaIT3dyrX1iHmqckEZ6ZT91iS5CrWId0WkGp4Ex6X1I4BfnFSIK3Cc3rIaCVbhBY6Xhu7rEkk1ckOOjycir+WfIbWc0zs8qCqNaH1I+S69XwxDEnc 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: List-Subscribe: List-Unsubscribe: On 2024/2/28 14:01, Sergey Senozhatsky wrote: > On (24/02/27 03:02), Chengming Zhou wrote: >> static void __free_zspage(struct zs_pool *pool, struct size_class *class, >> struct zspage *zspage) >> { >> @@ -834,13 +841,12 @@ static void __free_zspage(struct zs_pool *pool, struct size_class *class, >> VM_BUG_ON_PAGE(!PageLocked(page), page); > > Who owns page lock here if free_zspage() doesn't trylock_zspage() no longer? Right, it should be removed. > >> next = get_next_page(page); >> reset_page(page); >> - unlock_page(page); >> dec_zone_page_state(page, NR_ZSPAGES); >> put_page(page); >> page = next; >> } while (page != NULL); >> >> - cache_free_zspage(pool, zspage); >> + call_rcu(&zspage->rcu_head, rcu_free_zspage); >> >> class_stat_dec(class, ZS_OBJS_ALLOCATED, class->objs_per_zspage); >> atomic_long_sub(class->pages_per_zspage, &pool->pages_allocated); >> @@ -852,16 +858,6 @@ static void free_zspage(struct zs_pool *pool, struct size_class *class, >> VM_BUG_ON(get_zspage_inuse(zspage)); >> VM_BUG_ON(list_empty(&zspage->list)); >> >> - /* >> - * Since zs_free couldn't be sleepable, this function cannot call >> - * lock_page. The page locks trylock_zspage got will be released >> - * by __free_zspage. >> - */ >> - if (!trylock_zspage(zspage)) { >> - kick_deferred_free(pool); >> - return; >> - } >> - >> remove_zspage(class, zspage); >> __free_zspage(pool, class, zspage); >> }