Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp444367rdb; Thu, 8 Feb 2024 10:10:48 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW+wnc8gpEzfNYhPw/34E+rp31cYsRzdAcY98geTCuBSdArORuX4fOiP6eo8Zur2aFLCgKmiGrs+3ADknRKe4dn9KeUNJpb+iopPBnl4A== X-Google-Smtp-Source: AGHT+IGa1ARaDB+tN+p9uvQDqW41K+0HVvKc+H3nW5ANDHzTo5ne5N1gyPreavY6ZWRKbcxShVmU X-Received: by 2002:a05:6a20:12c2:b0:19c:9ebc:93b1 with SMTP id v2-20020a056a2012c200b0019c9ebc93b1mr383908pzg.59.1707415847810; Thu, 08 Feb 2024 10:10:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707415847; cv=pass; d=google.com; s=arc-20160816; b=BPpsx3DhX1+nKsho72rtzSh//zh9PC2dy/Q/veJHe64nly4Adbnk0oplqd8S9SYstQ rb/niPjjY5hJWb9YELVH0l6sWucFRX8B7jbzoosnVpjbtEH91bwHHWmJHE6qb/4Odkj3 jaAb6sY9u3o+5uCZhdg+gTXwQfqpcLyR95cPz81UDhzkZRrTLYa9Dx9sqwjlUSZDxH6U MGjICp1g4JVDeKp2zHx/veB5VCuv/DV72j1cD9D8l8CRhZZnzu77jT94aa07UJG22Kaf 9xZXqe0f4PWixSCP7BWWKyjijUVqL/m/w949F/2dOe6JeQAmgacB4fekY1rQ/y2O4mYS /NAA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=N/ASSALdlXfADx7dHfiQ8PKR/4AOTnL/3DT95dp/y7E=; fh=skeMNyHuYD897XuIZ/2q9romplx0lnDKxUxyeIuhMaE=; b=0sC4GDLAozr20aL5Cdxq/ORZB4s7sfdFgDCi5tLtSZqLq19DpPcZM4nVzz7Nqvvwlh lCbagVA4AG9m5xNYRr0mSjrECLrOVIgZ5TfaZ+HSZLQlukeorDUUAse5LjRD5u0LMewY JXNmk1DDRP669/H6+petYIUhExUM4gZOpl5lWdcC9QHoPHadq0tbQENbuWtw8IahNfDk 7+tUUu6FKYPeAK0ShFH3RWATHRNchDAwBKAigAdi2gwvfJ25Umgkb/jLT1ZghGXuMNTP IwmJyvf5hjKt7zA7g62LbNx1xprgFuCb7Mw5/13zQizR0syi1gKUXUvUo0CnYX8LgGT8 qU7Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=ZGcUihk7; arc=pass (i=1 spf=pass spfdomain=bytedance.com dkim=pass dkdomain=bytedance.com dmarc=pass fromdomain=bytedance.com); spf=pass (google.com: domain of linux-kernel+bounces-58469-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58469-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com X-Forwarded-Encrypted: i=2; AJvYcCU3+2GTQIQLtEthpyqR469AqUeJq+oGHTojesShwU0U7WUmoxzs/M0BqyZBwoUmMg9rzUbM3DcTNo2v99CbfA1UINfnEMq+35K8yKQqaw== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id h13-20020a056a00170d00b006dddfc5e391si51466pfc.20.2024.02.08.10.10.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 10:10:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58469-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=ZGcUihk7; arc=pass (i=1 spf=pass spfdomain=bytedance.com dkim=pass dkdomain=bytedance.com dmarc=pass fromdomain=bytedance.com); spf=pass (google.com: domain of linux-kernel+bounces-58469-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58469-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 64CF4B27E4A for ; Thu, 8 Feb 2024 17:39:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0B276823CD; Thu, 8 Feb 2024 17:39:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="ZGcUihk7" Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 783B981AC7 for ; Thu, 8 Feb 2024 17:39:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707413971; cv=none; b=OtQ7BqJ2wJ9okazzniuuJ6JtPhCYCQe8RW28VF5Mfv45HexYMYVLNn7PA9AJcWgjarT0NkGF6DxY4skK54kAqa6yMHumYPKr9KNUn8WBhmPmE7yajXuZiKWLZyDrFyDsj68Dx0ysmkbPQsvL/K0PGOVNrBRSLt93gVxYvp1lEGk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707413971; c=relaxed/simple; bh=lK/tbkSqE/sBgOS9MM7ieTUNviQqD9X/ACfXaaSlZ10=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=rSNKDKFldaRheVe7PE0dXG3TYZ95Ikw+o1CSnurLVAR2oisgSDByzNWun2f7x7gVXgUDZZwzz+Py2fcALeH9HLzXDFoVc8Z6mGOQ1Grc8vJlnKDemsN8+al5yx2/3Mfa+a3Y1KpTQRXGRlv1jn6holchaDlw0+DDLOizMxPIY9g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=ZGcUihk7; arc=none smtp.client-ip=209.85.167.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-5116b540163so55093e87.1 for ; Thu, 08 Feb 2024 09:39:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1707413967; x=1708018767; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=N/ASSALdlXfADx7dHfiQ8PKR/4AOTnL/3DT95dp/y7E=; b=ZGcUihk7zkiAcehGn439JtuTWDKMTNry//p54CtJGN5Qpgbe/uQprQXiBEwmzp+FUf 1Lb/T8npSGtIEb7QniRuZjJILspkiVzJU5wKMOh2OpbUwlb8FM/jtOCiAt0qHMxD8WhG apNxd7awxt/xzsWoyr6Orgoql8yvGvT2VS7Qx4mvTc3zMiOYzniEI/Y08mharqLs/ZcX TsCSE56pEGwImDRT4eCtJOB5VgAyTLoTGy/iE5mq1mTpBmVv2RGh7PM63MxoFYaDwgxL yde4tDfcUspkjw1jOFZC2gQGWgjPqMoX28twmgEUqqixmAif1csAAUfV8i0beEeo3U7c 2BxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707413967; x=1708018767; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=N/ASSALdlXfADx7dHfiQ8PKR/4AOTnL/3DT95dp/y7E=; b=KHNd3sbVA/pYzzshwHfnANOdV7VQ2gOX010H/69uQoAkIyxLVDtMmnVNfHtRLxvG3t Qy433A3cqG6ZYx5fQvbhfjkVW9pOxJv44u/HzgEhM52vgAD1/gjnguXF15G4gwXHEhnK Cm6bu7zl0xVs96PT7ZQKUYdBI5P27z2MS/kcEY0o6RbLdmgYFnysTJX0PGgM0BbIBGxK IL14xiq80qf8s5qt1abiyhjWWJX8N01lvtiI8aGP3vvt+M1rryGXIQMSPMsj/RFULhKX BzKmLAgg+BmESD92AbIx7Tp4p0k82FpIT/xvsYLDxBUSj0ZgTh98X2JGA2vDUlldm+HR xwcQ== X-Forwarded-Encrypted: i=1; AJvYcCUkeui0BbagKpvHkvHvM3pq4f4Cr7eeEaTDNclaJLSLmVL/EjvyxXoKoVIcqEjDYcGIwb151A85WnIxNIyHp8TQVCIP4rzmj8Sp6Kbr X-Gm-Message-State: AOJu0YxniZBcOfKZH0deW2BUnaJpJASrQTCYeJZZjZZJpieXanICZ61D 0MFcQjRDB4+5TUpa7Wjl+WqJ7fQKOwueBYZo+OGr7OaQ7ack89TNLbpDpXrkRuFDATs9y5hKm2j x8ANzp5hI6GIh1mw6oZZAJgXQRJcsCxdVQDeBD08XZBTkTDEbE0s= X-Received: by 2002:a05:6512:a8d:b0:511:19f4:e24f with SMTP id m13-20020a0565120a8d00b0051119f4e24fmr7928695lfu.47.1707413967429; Thu, 08 Feb 2024 09:39:27 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240204125404.2112384-1-hezhongkun.hzk@bytedance.com> <20240208032908.GB185687@cmpxchg.org> In-Reply-To: <20240208032908.GB185687@cmpxchg.org> From: Zhongkun He Date: Fri, 9 Feb 2024 01:39:16 +0800 Message-ID: Subject: Re: [External] Re: [PATCH] mm/z3fold: remove unneeded spinlock To: Johannes Weiner Cc: Matthew Wilcox , akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Vitaly Wool Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Feb 8, 2024 at 11:29=E2=80=AFAM Johannes Weiner wrote: > > On Mon, Feb 05, 2024 at 09:08:05AM +0800, Zhongkun He wrote: > > On Mon, Feb 5, 2024 at 2:46=E2=80=AFAM Matthew Wilcox wrote: > > > > > > On Sun, Feb 04, 2024 at 08:54:04PM +0800, Zhongkun He wrote: > > > > There is no need to use spinlock in this section, so > > > > remove it. > > > > > > I don't know this code at all, but the idiom is (relatively) common. > > > It waits until anybody _currently_ holding the lock has released it. > > > > > > That would, eg, make it safe to free the 'pool' memory. > > > > > > > - spin_lock(&pool->lock); > > > > - spin_unlock(&pool->lock); > > > > > > > no, please see the commit 'e774a7bc7f0adb'. > > > > spin_lock(&pool->lock); > > - if (!list_empty(&page->lru)) > > - list_del_init(&page->lru); > > spin_unlock(&pool->lock); > > > > The original purpose of this lock was to protect page->lru, > > which was removed now, so the spinlock is unnecessary. > > But pool->lock protects other stuff too? This doesn't rule out that > there is some other ordering dependency on cycling the lock before > freeing the entry. The person who would know best is the maintainer of > this code, Vitaly. Let's CC him. Thank you for your reply and look forward to hearing from Vitaly.