Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp403454pxm; Wed, 2 Mar 2022 18:29:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJwYNJh52cwKCjzv8lF2g2WDHjyz+RY3j/q90hpRqXbxeLnz44NKxQzOVoy3L4p9v8xhj2Hp X-Received: by 2002:a17:902:9a48:b0:14f:a377:ee7e with SMTP id x8-20020a1709029a4800b0014fa377ee7emr33884323plv.3.1646274579586; Wed, 02 Mar 2022 18:29:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646274579; cv=none; d=google.com; s=arc-20160816; b=sABSBtzQlMWMI1LGjnBY1XY3UAw/RXsTOin2r4SB4M9UwI92QvovV+ZZaHe49FQCEY la+EL7uVRZ6fERdXNBMrwkFCDwFczNpg+5b1XphywN707atVWBH+W0FV9Mn3tMg0HEep TcDPfxe+vzpo82wT6yTA+ywDR+i7ozk/IOfty0R4O7YeeT7iTQUmsCqN+StF7vQ4qdoY v54qX55GBk3qkIfklzRhn9C1qi2DyL6iyYGwmdy7Gzvofg5jNuuJs7H+D8y+EPhE4uer DlEZXVLx15bzh4fG9W0LAzFMZp91SJTw3YFj0010g95mnkZvUM6cZbDUvlYkisSz1lRX fdhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=b6428GOn3w9AJ2YAFqb8P+sUb0LnrEmXRGlOy7ti6go=; b=dB5kiv6aKfncj4bsTOKeXXQe6xWPfJb+xVsQ0Op0phdlsYTfgRzihoYnyPaxM82U8f /oyZV9G+DSKc3gVkTMbqTUKcjelZU4B83iJcKwilSeZrkTOy58Wjnm+G3kCkvGxbxgo7 Lqaz2zDqgN0jjIqMIgHM0Baee4qkeMvFtuiWZ19GLeWbRC6pr/dxMq/BfrqWJ2sVCkiQ GBjXoZcFnRJPvUoDp0j2NTOLUpKOecNkn6CZs8v8GoTOUe5tDj8jddZtERXHHBBRVhYS Seb2SDZdUNmwUjmDIXIHKoQNr1VOlWHYY8MSifE0GRl27Di5wkXz4MYCuIupbqb6ltRb OfCw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id z69-20020a633348000000b0036fe3b212cfsi790574pgz.602.2022.03.02.18.29.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 18:29:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F1FCEBF4D; Wed, 2 Mar 2022 18:27:20 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231750AbiCCC2C (ORCPT + 99 others); Wed, 2 Mar 2022 21:28:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231747AbiCCC2B (ORCPT ); Wed, 2 Mar 2022 21:28:01 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10A79C0D for ; Wed, 2 Mar 2022 18:27:17 -0800 (PST) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4K8FGF4CJxzdZRs; Thu, 3 Mar 2022 10:25:57 +0800 (CST) Received: from [10.174.177.76] (10.174.177.76) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Thu, 3 Mar 2022 10:27:14 +0800 Subject: Re: [PATCH 6/9] mm/z3fold: move decrement of pool->pages_nr into __release_z3fold_page() To: Vitaly Wool CC: "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , "akpm@linux-foundation.org" , David Laight References: <20220219092533.12596-1-linmiaohe@huawei.com> <20220219092533.12596-7-linmiaohe@huawei.com> <03647389a32045f38ec18b090548a26d@AcuMS.aculab.com> From: Miaohe Lin Message-ID: <7fab39f6-1a65-9577-4ddf-f3e984474844@huawei.com> Date: Thu, 3 Mar 2022 10:27:14 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.76] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 2022/3/2 18:19, Vitaly Wool wrote: > On Wed, Mar 2, 2022 at 10:12 AM David Laight wrote: >> >>>> Atomic operations aren't magic. >>>> Atomic operations are (at best) one slow locked bus cycle. >>>> Acquiring a lock is the same. >>>> Releasing a lock might be cheaper, but is probably a locked bus cycle. >>>> >>>> So if you use state_lock to protect pages_nr then you lose an atomic >>>> operation for the decrement and gain one (for the unlock) in the increment. >>>> That is even or maybe a slight gain. >>>> OTOH a 64bit atomic is a PITA on some 32bit systems. >>>> (In fact any atomic is a PITA on sparc32.) >>> >>> It's actually *stale_lock* and it's very misleading to use it for this. >>> I would actually like to keep atomics but I have no problem with >>> making it 32-bit for 32-bit systems. Would that work for you guys? >> >> It would be better to rename the lock. > > No it would not because that lock is protecting the list of entries > that could not be immediately freed. > Or could we use pool->lock to do this ? > ~Vitaly Vitaly, is the patch itself worth a Reviewed-by tag and go to the mm-tree ? Could this enhance discussed here be sent as another separate patch or am I supposed to make this change into the current patch? Many thanks for comment. > . >