Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp330040lqb; Tue, 28 May 2024 17:51:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU0IIZoFo5VmP1bR3pvpD0FXeQCvvYdEq3OV3WqCgofscsNodygGDPBQi7PuxOetkv2Ijx3U71TY45+TIWtY5KnlJcrfcjs5M4IkZCsAQ== X-Google-Smtp-Source: AGHT+IEU+SekT9JMpEzn16NeKLoTdOZZYncuGGem7aMcm0yA79jNammA/c9o4iuJ0SOlpn/qCWQu X-Received: by 2002:a05:6000:18a5:b0:357:b063:183c with SMTP id ffacd0b85a97d-357b0631d3amr8559212f8f.5.1716943873113; Tue, 28 May 2024 17:51:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716943873; cv=pass; d=google.com; s=arc-20160816; b=QcwkXQHdlOsPTJn1j9e0aAi8lqju2ocTDeXYa9EocOf1auYf3RAHMuGztA2TjEFx/q Q3FD5owKq2fpwY1tDrHBewfUXCzqxp+UnbLzG8VNhYjP3s1lx2M7ZJRPJzj1ybOhRQ9p aZc6by8pXv8c1iD3HtioVpxBGbg1s/ZIavIqiU8Dbip36ZZ0P/4RDA0V6qec1jUC5Zba +g1WLTUBtU59++NscMkB59ynu9Sg+4MFb+B6UglbVT2U+6HQOhtuIvmksWZsX3jcltFb zPTdWenBwhaNz3TwtTe7X9MtnaNbm4stjnuPfsOqotFkrDUb7eUxulG1GFfoLo/KoKZi UVEg== 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=gy8VhrOPTD74KbeD1d1aJlIrKyZX7ap3ToPIt6RxUqc=; fh=wwYL1m9imzKvg+N9j7BtpIwlyFY0BzWLtgo5Bw38p4M=; b=PIRfSEgi6RG66kHF/gcN6xdmX8Ct9wrHUkRosBppJuXdZxP1hDDRle/OaSr9hawmTA djEMiaHKBUjYge6PsgA5VHGqhWV+5c4GKs5hyGOXv94WKbOpUHclVKMYe2Uv3Tk7uwCx kKyPw7bgj3Fx0cOSnlaCDnYdTE5Sj9vTrECVxUBYy24XsLHkFlNlY6C5A9lxRgMBxv/W eV307uvcgxpwOoP0YcuvoQT9pPyrYvM3KIr+ZEcsTtyvp93/qWkJNmBw7IvPqanywsHj UwfkWIVmyJtY3Aw8kletrop2z2+wJT4QypfxzIIeQRBv2ukQGwDtEuSFuMhxWQiRJ+rD AwAQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FlgqGMPt; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-193273-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-193273-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a626cc36b3fsi579647866b.437.2024.05.28.17.51.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 17:51:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-193273-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FlgqGMPt; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-193273-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-193273-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 am.mirrors.kernel.org (Postfix) with ESMTPS id D1DAA1F2665D for ; Wed, 29 May 2024 00:51:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6F8F315A851; Wed, 29 May 2024 00:51:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FlgqGMPt" 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 93D1415A4AE for ; Wed, 29 May 2024 00:51: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=1716943864; cv=none; b=rvVxtQ55N5KqkeztoGY+qJOqW5CsWhQGXMQnJxR6rUz/VP1Ne0skmyyb5vCbPhfAGT8MDnfZG8FNIVJGWKQDjmRwr/N/OXtrTLUGN72f1uNLeeXpdDrQrlT5jHWiprgbTxYvhxOh3WgXJ9QJ+8Dw/qnHsMMjqbJiKKP+AmRuiP8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716943864; c=relaxed/simple; bh=+pWlSZoqw64YXEzXVNhuJ9yIm/GIMMuyBwrK/e0NMeY=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=hqV0Hw1EWhJuXbqAwtLBvmggx8QqUmq7JUzGqBcC4EUh+BSFIzwPf0Lnx6zhJh2wKia2TMVqqVvRHf/lOKL0DHbk4SAQ41QRt9yqFiorczaB9/CqdAyfu4+1rsC8Y/KLaSHrCj1J6VKekQItnYALCcEmcNGXlvIuOhwZjAblou0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FlgqGMPt; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B548C4AF08 for ; Wed, 29 May 2024 00:51:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716943864; bh=+pWlSZoqw64YXEzXVNhuJ9yIm/GIMMuyBwrK/e0NMeY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=FlgqGMPtQqHOPDHecsp8EBKaTdhdv9cRUrYagS6y/hQClOeozYoo5srrAxM8EO5oa c8ZFk8Kp5Jaz3Sg8y670BEQWBTFfEmQdgUQkreMOLZWTlNT96a/OZGRmLuZe0VBfTw qM/vzVs6n8BdHv5nNv/yPfafNodXs49+7umxdvumTLLpecwhmWFv5fBX+dD0MZ8aXj Z/Y4Mn1ek+SiSi55yie+LLlRPGn7JSPfLTxYWy5J3pq9BC68b3qXgfmiNEuJaUOOiF n3CZuLkmb/T5YGPtw2f9Dop19AVq4k1pFoV7rmNZml7bEjWBWlhIYLBo6ge1YrxLV8 irMMcylxgN3fA== Received: by mail-il1-f173.google.com with SMTP id e9e14a558f8ab-3737b70a74aso1336945ab.0 for ; Tue, 28 May 2024 17:51:04 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCUl7RVS0wxkthrrtNMvjsHpPfUWA6y/WaKZvBlIrqkEZuKojFOrZIdIH7ERUySNpnZEKQLFncfzgoVHQAiiRQCqe8z/IH1zeaAsc4Ne X-Gm-Message-State: AOJu0YxmyTfsQqJghJHOlOyti05VPd2ECiwHwlWHo9EGOi76PEdzabUv CjhQAUYH6um2Vm0O3X8dTmHTq7aYWJrZHBA4LLYfpAKvcO6t0DZ01GLDuOgU2RWDBs3e86AiuPx qwE84pjVOBe98cPoapaou9c8MLTy/cwsL9Nng X-Received: by 2002:a05:6e02:1d09:b0:373:8d04:28a4 with SMTP id e9e14a558f8ab-374737150b6mr5970915ab.13.1716943863281; Tue, 28 May 2024 17:51:03 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240524-swap-allocator-v1-0-47861b423b26@kernel.org> <20240524-swap-allocator-v1-1-47861b423b26@kernel.org> In-Reply-To: From: Chris Li Date: Tue, 28 May 2024 17:50:50 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] mm: swap: swap cluster switch to double link list To: Kairui Song Cc: Andrew Morton , Ryan Roberts , "Huang, Ying" , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Barry Song Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, May 28, 2024 at 3:27=E2=80=AFPM Chris Li wrot= e: > > > @@ -670,7 +562,8 @@ static bool scan_swap_map_try_ssd_cluster(struct = swap_info_struct *si, > > > goto new_cluster; > > > } else > > > return false; > > > - } > > > + } else > > > + ci =3D si->cluster_info + tmp; > > > > This "else ci =3D ..." seems wrong, tmp is not an array index, and not > > needed either. > > Yes, there is a bug there, pointed out by OPPO as well. It should be > ci =3D si->cluster_info + (tmp/ SWAPFILE_CLUSTER); > > "tmp" is needed because "tmp" or " cluster->next[order]" keep track of > the current cluster allocation offset, > in the per cpu cluster struct. Hi Kairui, Actually, you are right, the "ci" is not used here. That is why that ci out of bound error does not trigger kernel OOPS. We can delete that else line completely. Chris