Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp2534618rwi; Fri, 28 Oct 2022 08:10:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4lTkRhBH2gEirG0yWbjCa6cYYqOiLSAoJ4s66P1H3UAAE4kMKV1hKRRWd0K8ziTgxEFW+W X-Received: by 2002:a17:902:7c11:b0:178:a6ca:4850 with SMTP id x17-20020a1709027c1100b00178a6ca4850mr57533286pll.111.1666969810720; Fri, 28 Oct 2022 08:10:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666969810; cv=none; d=google.com; s=arc-20160816; b=xwxDzta1LMKjQq2enfrnuffRXE2MCilJKM5L7uiY7nf2r7cN1GKQyaWXYl3o0Lkun5 eHRt99UixQ6jbJQ1Fcog80ovbuMbGmwKVZLMdwwAzzSoLHvZhHbRvfQbTj0DbKsFsWho Q2DRVAIyANsT7cVQvRawpWPiXIT9I+bvH4tmOJxN4VeEc4Lw5kPE948Er4XYy6Sczmyd is3y+/ibDxbkQ6ky2O76E1NOsrD8iAgB0X15FzL1QRLfPO7NLbnmJGkyGy10C7+A1MNO of+yTuDp9h5hcYZJQGr77NACmnTIa5pKPTs7AIjK457RAW7hBflR1kIMyqG4RyDUTbkA j8xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1JbhK0WAu1TP4fT7MkKzuH3m54mzyTiAcFsJp+ELS54=; b=PBI+0Wdf89CfS05uxZkkc2vBPyfudSeU9UhBVZx0SKjKEYlEz4Y86qIR41dyksyYh/ FAoCCr0k+S+q6Ph5EBFgZow/duw4zGX1LFpkLEoxz0nx2sZXyLdw8fZIuiipNojJlj0H rIIMQnqXGp2e5D4PR//VUd+N5CnBAPqlgeIHXrbVGf2lWry2xpq9JZK+BDvHfztvaflV KK+rXpObShAjL62BRovr3xGI0luLuFKMoitv5Z7BdjPlyvtT6j96vWcvvGP4aPxX8dPw vCGwAaSNpm8krqON2JZASHSkcOd3ND1ZAhWoJeeh7Q3kKVbjjYIV4QQu4UOGf5N8K3qy WLHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=hqN8izkd; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b3-20020a17090a5a0300b00201d6d4cc79si9989479pjd.113.2022.10.28.08.09.58; Fri, 28 Oct 2022 08:10:10 -0700 (PDT) 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=@cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=hqN8izkd; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231392AbiJ1Oro (ORCPT + 99 others); Fri, 28 Oct 2022 10:47:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230449AbiJ1OrJ (ORCPT ); Fri, 28 Oct 2022 10:47:09 -0400 Received: from mail-qk1-x72a.google.com (mail-qk1-x72a.google.com [IPv6:2607:f8b0:4864:20::72a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90A131FAE62 for ; Fri, 28 Oct 2022 07:46:36 -0700 (PDT) Received: by mail-qk1-x72a.google.com with SMTP id a5so3532465qkl.6 for ; Fri, 28 Oct 2022 07:46:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20210112.gappssmtp.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=1JbhK0WAu1TP4fT7MkKzuH3m54mzyTiAcFsJp+ELS54=; b=hqN8izkdXwMnVjLZnFayzyxMO/+hd0tIFwj41XF8Z5d5SsCCWgelW2O/G+RUh/MeOd Z2zEbesVmyp8FSJ5y2cjLT9KILEqgtC7KoqHz1cpgURjaN47oZ9FzheO3E0IKutEg2x4 AGFjDtYbTETv8iqAf46l9XPMxnpHH+eRoV72L4O6HKBU5oF5wy2Lh8lbrP1/4pilBIy/ 4AH08HK5GKRCgZqf/r4/2zOTYS7O3lSf8Z1jXx50rrlh8BkpE/YdpbCQ3h49VRj7zOFH iU9j6DqC6fZbEAUcvxUjV5KJee2GHQBg5bAbL6S4ufikAs4rzkK2GsXAiKRBYcNSAswp YE+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=1JbhK0WAu1TP4fT7MkKzuH3m54mzyTiAcFsJp+ELS54=; b=QMGWVeVeBzdaTERvq42silut8zC52FDaBLBYDfuoXckknPjw5/he6xWP6frRd3GyV+ M1QPgxiY8AY9QoYpRwE8P0VO2PnXQtkHz8wUAMhOyDEQU1CUq051uPm4weoZjI9RBgEO H1pECQ/o3flWM+BMrTbN2T1+ViIC2FuTMLztQuJGDwAeqFzYN6eFdZeBvv11qhs9pqEq jVF+NmD6JjiZiqVWF0vMXO9sc+utuTxQcjb38/DhdCXUUFxrK8+wx2f9b0XmFwqCJ1G7 vq31NqImjNVTx0MlIKxgmtKS490cxHe+QVPZDJDjgi6cR2gfupMd/9VBtlw0wBwVSvkk hiNg== X-Gm-Message-State: ACrzQf0B4juzFB2NG+uLFBiX/H4qsGNwyaO1MDVgLles05wc0fDX+4cA 0DMmZwCmCPcBQPamhRNy/3k3kg== X-Received: by 2002:a05:620a:4449:b0:6ce:d824:d2e2 with SMTP id w9-20020a05620a444900b006ced824d2e2mr38572515qkp.183.1666968395683; Fri, 28 Oct 2022 07:46:35 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::25f1]) by smtp.gmail.com with ESMTPSA id bl4-20020a05622a244400b0039a08c0a594sm2425824qtb.82.2022.10.28.07.46.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Oct 2022 07:46:35 -0700 (PDT) Date: Fri, 28 Oct 2022 10:46:36 -0400 From: Johannes Weiner To: Nhat Pham Cc: akpm@linux-foundation.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: Re: [PATCH 2/5] zsmalloc: Consolidate zs_pool's migrate_lock and size_class's locks Message-ID: References: <20221026200613.1031261-1-nphamcs@gmail.com> <20221026200613.1031261-3-nphamcs@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221026200613.1031261-3-nphamcs@gmail.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 On Wed, Oct 26, 2022 at 01:06:10PM -0700, Nhat Pham wrote: > Currently, zsmalloc has a hierarchy of locks, which includes a > pool-level migrate_lock, and a lock for each size class. We have to > obtain both locks in the hotpath in most cases anyway, except for > zs_malloc. This exception will no longer exist when we introduce a LRU > into the zs_pool for the new writeback functionality - we will need to > obtain a pool-level lock to synchronize LRU handling even in zs_malloc. > > In preparation for zsmalloc writeback, consolidate these locks into a > single pool-level lock, which drastically reduces the complexity of > synchronization in zsmalloc. > > Suggested-by: Johannes Weiner > Signed-off-by: Nhat Pham Acked-by: Johannes Weiner