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 B4238C38A02 for ; Fri, 28 Oct 2022 14:46:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 56EEE6B0080; Fri, 28 Oct 2022 10:46:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 51F446B0081; Fri, 28 Oct 2022 10:46:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 40E426B0082; Fri, 28 Oct 2022 10:46:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 323706B0080 for ; Fri, 28 Oct 2022 10:46:37 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id F34911201BB for ; Fri, 28 Oct 2022 14:46:36 +0000 (UTC) X-FDA: 80070634392.19.DBE7619 Received: from mail-qk1-f181.google.com (mail-qk1-f181.google.com [209.85.222.181]) by imf26.hostedemail.com (Postfix) with ESMTP id 731F7140009 for ; Fri, 28 Oct 2022 14:46:36 +0000 (UTC) Received: by mail-qk1-f181.google.com with SMTP id b25so3541045qkk.7 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=joV8cw1KdQ5nlIyBp12On2wejP+zXznnXSoE+7SVEBUUpY8J5DD6/PE8WH+PrsMT4R sBVWs3UqDisnVRFBkzU9s6zHDLmfZhBzW+PoJGmXMC+6UZqWd97I91p54SlPSNAe3XAm RIWgryxuzOWiquCt1IG9JtKD5I+F+ycDZIcZUUVcbVklIFSYnnmbKIGAdQ4iDlIfBKa+ 76iwB7C43pHKoi3ROTBgvKEH2WsqGXonqeCsSuBrL0ESDmfk/TTk6UMOoFb1Hq0jUUGS GAxyx36gzKWY9/c92LpVS/lG4/Ts+anXGwiNlGh4zlBnCIf3sQOXZOrTXVX0Lomoc0X6 GVsw== X-Gm-Message-State: ACrzQf1peKUEEM/oRcLpRlOBYHXSuSWweWHf6lOU9QRZshjvO15yIxEx g5pMSXR/gwFOrw/rRy3Qg6vnpA== X-Google-Smtp-Source: AMsMyM6rLyEvz1oFaIKmxYvwUnTuL+n+oIU9FRKMF1g3r1G/sKu8v4moHYffGPnwSORz3lOVzZtY7g== 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> ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=hqN8izkd; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf26.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.222.181 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666968396; a=rsa-sha256; cv=none; b=YPz0G7s1p//9SFwniYe9cuCm6OYNRexqovR7RJ3UnynKzJILuB4eYxgqmFJ5wNCgAYKsXs mjk/zqn5VKsKM3I/9JcS+heBuehmuWrFM5UWw6iJLiQp+T4ByxHzDGTsNFRmmlfCMMaPWV mpEtW5N2hAjR+sqYmPiM8Njx9CXionk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666968396; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=1JbhK0WAu1TP4fT7MkKzuH3m54mzyTiAcFsJp+ELS54=; b=1EJG9p6Bc9eG6Qy5m8oB7/ToXSKYdBDRxBR0Pfm4+yCbMDov73QL4z3I7GUaKR+VIbAHEW 7o15vp+VpKJWfbOIacZ+peWBaoL3F4CNxFZ0qTsQNxg15EGGhNycaL3sN/5TwpKPcaNuyR WqmywzYXyGBAR3iEEQcQuu8VR9Upwrk= Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=hqN8izkd; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf26.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.222.181 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org X-Rspam-User: X-Stat-Signature: ysgr87qgzzst5cb8qbxsd7hkc8xrtfum X-Rspamd-Queue-Id: 731F7140009 X-Rspamd-Server: rspam11 X-HE-Tag: 1666968396-394296 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: 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