Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1667054lqt; Wed, 20 Mar 2024 10:19:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWK7jKNuvfVC+ME0v33yXIx/u7Fs33i9KQtst+t/fjNsc9rk2eu1FYZcUY4DN3QbTUyuTPql7RMHl53EgMviF02Tr5GqSp3KOm4Ct/9Iw== X-Google-Smtp-Source: AGHT+IEy9viClEMYSVi4+W6xmKnrdCsgwENaxYAU08j2GxGw/o8hFX2US0d4iOQfToq5rGNoCpVR X-Received: by 2002:a17:902:784f:b0:1e0:511a:ebab with SMTP id e15-20020a170902784f00b001e0511aebabmr4013288pln.43.1710955176451; Wed, 20 Mar 2024 10:19:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710955176; cv=pass; d=google.com; s=arc-20160816; b=g63X8td35mTHllmxcd3iIZyOYnnBuO4VSbAjGf8XwqFE/CR2m2EEX337dV51CDhdvt NO1w9aVjq59nvRyI1SI85QtK+ut8Pryj+c+vTOro6q15Vxn1gMmPSFwxqmUgEzpLSqO2 zsYt9/V3vSrm+oPS3dBROzcnfFEi55r+JFo8ue7TMA0jPd9Ifh7Vf62kvdI4cZZcNaRu BDSRu9bd6tV1hX6qwLqWB0EBlZNtalBTOPeYDRVqDJnj0q309jaZyLoyG+q2HPV5QldJ 8dMzbLKDNqYrN7rtmfln3Na9FPEl/r18cp61tDCUOPJ73S1ZZUug7pEjc+t9Y7aKb9ut G9+Q== 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=YrHJYPRQxE5Zvv5TnRibVQ4dHuC7YD8BtX+J00w7sAs=; fh=85Vt8au32SHuPeqvAacNT/zedA+SewnpX+l8NWIw0OA=; b=xVuc99dGsyb9cqtWYCH+vrb7fOljNX2WAg4gda7O5VmL5i8g2wmoOmob8dpc70xXuJ ADjzivCixSt62G8dYT+X3EGMhelzLWcym0WEbXVFCtiprK76a/4CLWoWtuxUQIeQHQMh HGiS9c2RZ/NrQRjTYrA7W555Da0lCiAyFLgLAz2dtVdnSw6a2/uIQJl/JBYtr3aB2wiE ut4eK+BOEBA2WD7PE6fDFbHjbyl2tATPkY8aDrDOSMV7JIr3w7w0YGKs6sjkWFLDOrv2 A4CGGKCZgg/RkgzwKwAX+gPG6CBmnzfJdzEo8C5myv9TGtWZC/0yWY7BNdMHIgdaZUEj uUXQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=cvswr+8H; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-109220-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109220-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id b15-20020a170902e94f00b001e02cd75dfcsi5933386pll.464.2024.03.20.10.19.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 10:19:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-109220-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=cvswr+8H; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-109220-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109220-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 9CD57B245F1 for ; Wed, 20 Mar 2024 17:17:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CED876A323; Wed, 20 Mar 2024 17:16:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="cvswr+8H" Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (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 169276A327 for ; Wed, 20 Mar 2024 17:16:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710955016; cv=none; b=NTNdTZYlgJvEubdAvFa7jBRraCybsIVJYuRjSsJ0j65z48njvjAnXBPiJK92ofAeREmX0zC38917j4f3ZfPfVr38DekIJ7cpFKZ3/ZBgL44FjNal3xZOXfdp/kRQPtpzw4skN8HXN2wRejH+6Pt1GdFQRbkMPIOiVKixQoZyOb0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710955016; c=relaxed/simple; bh=PTgza+W1/v68t8gIEmwRzft+VKxQNQUrzbgfRmoXdEU=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=hG2mlh/fE4QHkVepF3RtQXivBIZ+onGor9yBBkEKS9j/Udfm8hMvYgVBbUOKlK3rxK11vSDKU32tqJDp7JeOqOfL+9CGLRrXXlilTCg55EBzOpEVKr1rqZpMLjQ4JpYuVpQ/HectCFcFzyNCcYJU18YrMR0wnnN5mUrFTnzaERQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=cvswr+8H; arc=none smtp.client-ip=209.85.214.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1dee917abd5so7775ad.1 for ; Wed, 20 Mar 2024 10:16:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1710955012; x=1711559812; 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=YrHJYPRQxE5Zvv5TnRibVQ4dHuC7YD8BtX+J00w7sAs=; b=cvswr+8HYd+GRt8xMmegLEgL6HiAjOdRLzqN0LiHFRkgA8kmPELmLfTXbuK/Rcy5EX mp4/xmo/1xw+2eN2af3oEYYMqXUaxSw1qvs4FUstxpoZ0QLQm1p2dcJeo68Lad3Im0qj V+wzQxKe7mC5VRMo5x51EtX0/xNZHHWmG0MMWxtfek3dzioSRlOu2GDBLyUiPJ3ky/Lx Zg6uvHtt0KQm8uFqMtrO4k5ujNdomz9JZZelqhZ97zh5pkpIqxyhZZFSuTng5RqTiXaS vsos5lGzQpZC0uJ6+KC726lf81+w9FhXaKTjD1tMyPVI3XiyAbKdNMX6vau+SbjkagEs iPGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710955012; x=1711559812; 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=YrHJYPRQxE5Zvv5TnRibVQ4dHuC7YD8BtX+J00w7sAs=; b=WhRoqj9rgT3nWprwwZk08OppJYvYOITbNMuNMTyB888jy479tSdtI/a83BU3oG7Hoz c+kYeg04QBx3andvfWWqe2LofZF1Nm49kyAAJh4W8J2szufVtpzbXBB95gVIM68+q/zf VS6kxbKJVy9MiEmP/UIkO3xqM0SxbOKO8p71FFa5zse6RFA+eKr4CNGxywhme1RKLOK8 u1O/HWICtAM0ywpj8za6ydLfAktaGdCN2AyHzGZhmqBdPOb15rPxmtWy8sLUHbYmikxo FCXntYNqSP3ittn0V+mWWacNuS4giuq2nNMtu7aZbB5moyYerxWpxQ4C/+GMyhP7DQNV +rNw== X-Forwarded-Encrypted: i=1; AJvYcCV+9gCEj56G+ZGUlSfATmHEbSPSV8CY64eB9u/3/trTta4TFS4n2ZDOxLZh4X2QLFp/81Skty22Ifi9dx6hJ16rldOlzud2h5GH18g5 X-Gm-Message-State: AOJu0YweuKVpt8my39Ub/yQlWZstoo/OyiKcVbG+/5QRaSYLvkVW1YtY FjYK/lj0yi5zfhBBx9ChxGXL4uUDWuWfMChNqNddAWYvAspmIvJWs80LxrEyqdf19UB2d5ZQWw9 b5K1jRmYEfMqBfZWlaV1HxXNE+qyLTLYFJRMx X-Received: by 2002:a17:903:41c4:b0:1dd:65bd:69ec with SMTP id u4-20020a17090341c400b001dd65bd69ecmr305677ple.20.1710955012019; Wed, 20 Mar 2024 10:16:52 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240320145417.336208-1-visitorckw@gmail.com> <20240320145417.336208-14-visitorckw@gmail.com> In-Reply-To: <20240320145417.336208-14-visitorckw@gmail.com> From: Ian Rogers Date: Wed, 20 Mar 2024 10:16:40 -0700 Message-ID: Subject: Re: [PATCH v2 13/15] lib/test_min_heap: Use min_heap_init() for initializing To: Kuan-Wei Chiu Cc: colyli@suse.de, kent.overstreet@linux.dev, msakai@redhat.com, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, namhyung@kernel.org, akpm@linux-foundation.org, bfoster@redhat.com, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, adrian.hunter@intel.com, jserv@ccns.ncku.edu.tw, dm-devel@lists.linux.dev, linux-bcache@vger.kernel.org, linux-kernel@vger.kernel.org, linux-bcachefs@vger.kernel.org, linux-perf-users@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Mar 20, 2024 at 7:55=E2=80=AFAM Kuan-Wei Chiu wrote: > > Replace direct assignment of values to heap data members with > min_heap_init() for better code readability and maintainability. > > Link: https://lkml.kernel.org/CAP-5=3DfW+FvUu8JL+KrtVv5uC++4AW=3DVhyEOgmd= WzpH1mswQNzw@mail.gmail.com > Signed-off-by: Kuan-Wei Chiu Ah, got it :-) Reviewed-by: Ian Rogers Thanks, Ian > --- > lib/test_min_heap.c | 11 +++-------- > 1 file changed, 3 insertions(+), 8 deletions(-) > > diff --git a/lib/test_min_heap.c b/lib/test_min_heap.c > index 062e908e9fa3..8d25fc8256db 100644 > --- a/lib/test_min_heap.c > +++ b/lib/test_min_heap.c > @@ -67,9 +67,8 @@ static __init int test_heapify_all(bool min_heap) > -3, -1, -2, -4, 0x8000000, 0x7FFFFFF }; > struct min_heap_test heap; > > - heap.heap.data =3D values; > + min_heap_init(&heap, values, ARRAY_SIZE(values)); > heap.heap.nr =3D ARRAY_SIZE(values); > - heap.heap.size =3D ARRAY_SIZE(values); > struct min_heap_callbacks funcs =3D { > .less =3D min_heap ? less_than : greater_than, > .swp =3D swap_ints, > @@ -99,9 +98,7 @@ static __init int test_heap_push(bool min_heap) > int values[ARRAY_SIZE(data)]; > struct min_heap_test heap; > > - heap.heap.data =3D values; > - heap.heap.nr =3D 0; > - heap.heap.size =3D ARRAY_SIZE(values); > + min_heap_init(&heap, values, ARRAY_SIZE(values)); > struct min_heap_callbacks funcs =3D { > .less =3D min_heap ? less_than : greater_than, > .swp =3D swap_ints, > @@ -131,9 +128,7 @@ static __init int test_heap_pop_push(bool min_heap) > int values[ARRAY_SIZE(data)]; > struct min_heap_test heap; > > - heap.heap.data =3D values; > - heap.heap.nr =3D 0; > - heap.heap.size =3D ARRAY_SIZE(values); > + min_heap_init(&heap, values, ARRAY_SIZE(values)); > struct min_heap_callbacks funcs =3D { > .less =3D min_heap ? less_than : greater_than, > .swp =3D swap_ints, > -- > 2.34.1 >