Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp28421lqg; Wed, 10 Apr 2024 14:15:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXmmj6KA/YnYudJiD3Ghc/mP2B0wB0ZETP/9gnijALmq39BafiIPIuEooSc2fsiI7qmxwugPx/4B1YS2V8fi6aX/unwAELUOUscn3FA5Q== X-Google-Smtp-Source: AGHT+IGmujBOTDkYAUfipHI1LVT78cpS0r4gXFryFRNj9CwjpunsryKszB1240F2Lk3bmdWqDwHx X-Received: by 2002:a17:90a:4b08:b0:29b:bbef:912f with SMTP id g8-20020a17090a4b0800b0029bbbef912fmr3463966pjh.10.1712783710257; Wed, 10 Apr 2024 14:15:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712783710; cv=pass; d=google.com; s=arc-20160816; b=Qb4oG0QZPk4NcOA1jG6eXzRqisZhmQf//gBmAVgqNBj3gip5xehOlXK9k7B2PvthV6 3RtQCm41hVt2Hu/k2/uLlQiDt3dG0BW//jUbd0vt1qF5OLLuDLoA64RZCmRz2wzr6x9n 0Zg7XQdcw+x4BT6kDrkMCyeu4QYh+H3++pK4bjGirYoXKdZenmOvsKvIvZsaO4n6Yy8p eCrBtiqe98HDQjnYMEm/d+uf4G8wTAA9dGcvZm8Rj8awUiHdtpeB68M5cvqdUsaA1KQL nhWjbTYXP1DZK31sji94lp67wVMXLSyOQoOumhw2QTYQl/XOHtCq2FciHhBug6eESGZC lMVw== 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=bLJPnax4qL6EbvyLVR0K3hnjSf/4Yjk4/FnnmMrKwEs=; fh=Tr8MHFN6FiIVsjjpo9r2oxpYZbjYuiwq3LM11A1Es1E=; b=T2xRJmAxhRqbrW7eCcXrdR02m5LuGknKFGwk8MRYyEF9T9WobhKJOYFtXaq1CEksaL HYBGInqCDpXDLQbTn9xp2E4J8trfHZboptY9sat8a65nWyHOqSd8s4r4mwAbQsjbRgtK mR2z6Wa/hMsh41JUMuQwmdgShvclmjdc+39GvnG/EczYvzsCiQcYdYJ/U/NDIem5vnZi FH18RFnQPNBbsfItPRelO+5GrC8YBSOVZ7lMp4XgnPsbiV7GDzwqx89pyAXn2hMjboa7 ExPumbVbb2V/UgAO0Z0jC2plScgPXe0HCqfOjqIkQ9L9V8cbSweXWG8fduYFui6m3b6O zgbQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pig9wYm+; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-139357-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139357-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id n62-20020a17090a5ac400b002a095d3ecd9si2217601pji.38.2024.04.10.14.15.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 14:15:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-139357-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pig9wYm+; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-139357-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139357-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 6FF652834E9 for ; Wed, 10 Apr 2024 21:14:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6942D1836E0; Wed, 10 Apr 2024 21:14:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pig9wYm+" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8ED4215920B; Wed, 10 Apr 2024 21:14:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712783644; cv=none; b=EkKJlJoUojQ4TC86MRz3+MPnL0NZR/yGTnrWhTR/5rHr1Iqk/jVOZJ9dGMXXKu56pozanLWa0lRqDcV1N7kD/inTAKo+txaXKHl3hkzYqPI2RIik31t6BE4DlV5VJJyxHJXcbbDciVCYhmkVbmxJ4fRMbHV8C1pYe9Ao3BBBsqE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712783644; c=relaxed/simple; bh=bLJPnax4qL6EbvyLVR0K3hnjSf/4Yjk4/FnnmMrKwEs=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Pf7a/A5hMLAXVJ1DxZdwHU9XBPs8LaelJriTSSZkGOC3PiagVoh0N3GR9MNHXKG2J45HWo0bwRx/ng4miZ+C9SIfVyt+iV+zq8B9AltvE5QKOXE/WJ0caxWUqE3ct0UWjGMYzsWfoc9nlEg5rQoClxL4XAYaMfqeuJupexQPopk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pig9wYm+; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A801C433C7; Wed, 10 Apr 2024 21:14:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712783644; bh=bLJPnax4qL6EbvyLVR0K3hnjSf/4Yjk4/FnnmMrKwEs=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=pig9wYm+6/nFCM0N14POyu3w+eVGvR/kNKOEK1mBQ+qYbbaJSqHXlfGrZFYJDD8+/ qSV0tJtC2OOo36nEzvt9cY8KDyKJZhYMMtAbwUiu0MDXeqg8Avom7CEscH5M4MapKY fCDR2zsGTFdE7uXwtEuTak6oev6nuaIikGK2JUJxcQZWrfRNXOzkcOH/tg0ggULhLZ mulV2MzaA1Kjcns2XElneHvjQYST6Z5+dFVTZhx7RHgFL6CWXXD2g/88L/7cHl5DTe a0VGL5OQYVVjN1Q3+Vg/fRiYoRFvaVQC0NoGtpsGgQJjXUz0KckjhzHElkzrYj3jnz JGz5yHxLUbyjQ== Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-5176f217b7bso1842607e87.0; Wed, 10 Apr 2024 14:14:04 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCVoD96sgvL1rMxM/DLJ4WSnrYp0NLag7qpVP178GoTVaBHaMp7ylsJMejC2pcXq0ADKjDBJ6yJ69urX2g0GHRUzLCQ4fzXAv9P0SVh4l8kdKpmT/vARWq3seNO4/eN46bDROj+wJK/oVQ== X-Gm-Message-State: AOJu0Yyoa+HMfu3q8AvVMJDbEhDUEO2qsQtS+Fr2DriyDrlBpFCmOiqU +DJS7e2GEIe2KtqNCHJCRu40LlP5t+0Nk4CxRtukk78Vx+px28mvD4f+Qyktc1Wdw1DvyJqQum3 gRpIRdzPQoW3lhsmmUYG/b9sz1O4= X-Received: by 2002:ac2:554c:0:b0:516:c44a:657d with SMTP id l12-20020ac2554c000000b00516c44a657dmr2939280lfk.64.1712783642352; Wed, 10 Apr 2024 14:14:02 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: In-Reply-To: From: Song Liu Date: Wed, 10 Apr 2024 14:13:50 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 00/11] md: avoid counter operation conflicts To: tada keisuke Cc: "yukuai3@huawei.com" , "linux-raid@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks for the patchset! On Tue, Mar 26, 2024 at 3:29=E2=80=AFAM tada keisuke wrote: > > Currently, active_aligned_reads and nr_pending used as counters are atomi= c types. > Therefore, when inc/dec in a multi-core results in conflicts. > > To solve this problem, use "percpu_ref" counters that can avoid conflicts= and maintain consistency. > > Switch modes of percpu_ref to achieve both consistency and conflict avoid= ance. > During normal operations such as inc/dec, it operates as percpu mode. > When consistency is required, it operates as atomic mode. > The operations that require consistency are as follows: > =E3=83=BBZero check for the counter > =E3=83=BBAll operations in RAID 1/10 IIUC, the patchset is to resolve race conditions and thus improve performan= ce. If this is the case, could you please include some performance numbers in t= he next version? Thanks, Song