Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp970431lqe; Sun, 7 Apr 2024 12:11:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUCUe/bpK9hpYcW2ifDj7GQC+O96t9iKkYKq/gte16pYJee1MVHpKtBuhj2QzkbNHJJVgk0GriLZqLCCofSqnyyvLqeY1ff9aQyHijZtA== X-Google-Smtp-Source: AGHT+IEjGiNe1ooD8I6lqvZFu+yOIA5PWgZ8WwhcjkpcpEeGtNeK/eMUAsUZsmP09QtvOUbU9QS/ X-Received: by 2002:a05:6a20:d48f:b0:1a7:7cae:24dc with SMTP id im15-20020a056a20d48f00b001a77cae24dcmr211933pzb.5.1712517114004; Sun, 07 Apr 2024 12:11:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712517113; cv=pass; d=google.com; s=arc-20160816; b=mSvQpSddyHz3p6ZEBVfjAixOQ+p150Jq504oFgyvYmtbehLDetEXPF0FsVn/sUVsYW Hvs/NL1feFvWHfWO2Mij9bRgIflgcrr2Z0ezmxl9ZdcywRDAb0JytlN2ijdWK9Gm59sM YtcnkxoQr5Qt88XHNv2HlwyfhVXzDs17WhZJfC3BqZArfY8nk+ZnupIn9VVfkYyoIQKO iER3tkJx/u7E5HWYWXNzaJauqVXXkyGuitxgDFI/LWxN/y2aRrZdP/U7cNjBcdBvhqP9 A5z2UjuZUT+oxJD9XYR0gHzyVfR7jBazs5pc+1eO2XOz6dlrCw24XWrgG42mPnkI9MtW Inew== 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=lNNV1iViAab2iT4F4Gl3z4rLSdw9SuHLMYt6mT0uMl8=; fh=YINcP1pdjb8xkb7bsndvYYUQJz94OEOc0B/a0eLRPrc=; b=uboq1HaLioXyzxmWi4O7+TxAOExXHk+da2Ce6C+6I3bMp7pSHJJmC059FUMehFQSY3 grEq3eQX/HC7NJFzg7QjajIy4a+lJbsJr9rx1TqW22OS8Yh/4Oqm9MQuY00D3DQrHfpM URLZFPQgtV1tGQJw6+oMGkGC4FvP+/cr3yR/HYTgFLa2VBLG7rDtN/Gm9XAICo9r0/uU n3fwymUrucVi0e8AkQkZIFW1AGHw0fBx1DvXGAntPHblTCQH7yI2tSxcIbqL59Z4geFy H3qp7iHnpoGVWxQGiX/Rta32TKFPUgymmBqejR73pUkWSK9bHF/aRXQaFKYv3+31whrU kftA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=fTKLukDG; 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-134621-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-134621-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id z3-20020a63c043000000b005dc42dccf38si4896651pgi.279.2024.04.07.12.11.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Apr 2024 12:11:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-134621-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=fTKLukDG; 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-134621-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-134621-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id AAD21281D4F for ; Sun, 7 Apr 2024 19:11:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AAF983D0AD; Sun, 7 Apr 2024 19:11:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="fTKLukDG" Received: from mail-qt1-f171.google.com (mail-qt1-f171.google.com [209.85.160.171]) (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 3E9893C082 for ; Sun, 7 Apr 2024 19:11:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712517105; cv=none; b=YpPT8UyawPT7VvoOt/QICAwMwG0Al/zv3PDQ1SPUhAB+8zm2J/TeCfVGcaTqjSMLOCYfSaLBe3ZWvECV0C2ONB/HLCRMNVtw40CHUl95YO7nt6n/KRgK09fcpI/nIFugLV40VtTk/gJYa3+33FGckRzEzgwHrE/YRWq6HGHl7v8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712517105; c=relaxed/simple; bh=5+ZSDJ1c1wayZpu3rSXMMx/gAZAOYnaNUAMMmnOCKrs=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=f4/wv7jS/6u3/0zDKkVrpb3kwl+kGQitVYGwio1vF+I0fRAFEUplCoJmPgIQGCjsWmvj91WC4D+T2HjNvOS2HJwY4mCI5/DangGebfYZq/4qO2BSv2JG3WKjcVpMDCLJuKXYJVOMbFMb8QtxlU8Q987njWrgy1GJimX7TGnGHMk= 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=fTKLukDG; arc=none smtp.client-ip=209.85.160.171 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-qt1-f171.google.com with SMTP id d75a77b69052e-43477091797so180971cf.1 for ; Sun, 07 Apr 2024 12:11:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712517103; x=1713121903; 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=lNNV1iViAab2iT4F4Gl3z4rLSdw9SuHLMYt6mT0uMl8=; b=fTKLukDGInZUB+fsQg3YPRTy9oXDUyPs1odEsay87TmR44G9qLwV5fwCxW8PlEyG2Y xxKX4HFnnEuVrtKLHT08eRxP5YnDkCrvxVQH+7b0eQzRE1M4/SYlenlaZelQMDx2uazL Kk7L1AJrxRL7qbojiqeXd7NovGDD3p/RYwHg36+8pRP37sZihDp/AYO/Vk8Z8b92j4Z5 QXGWDgi0gQFxTVm4Cyi250lvduGLxOir+fVLW611JuqGWYSUiWiqoVOmnn/aHAyylvLU jeGkQ2HZaRwUG4/MucAuXA2OqPh9h3HBgD+3/aftJNHbdihvEpV3RauE/trzj9uU1RLV sUxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712517103; x=1713121903; 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=lNNV1iViAab2iT4F4Gl3z4rLSdw9SuHLMYt6mT0uMl8=; b=rD+HxW9iAVtOKAbCy1FuVfkfneifNypp2TwKLJk5rucvY8lcamkxLfV6DLyv7f/9kG QPZcu5vB4BSYgpOlmFw6NxK+XYKbwwyDAi/segTUDbmn0iFjo7suJlG5h32OBd3I9F8d VGqgAde0UJzmDZMN73JURPQmTLLoJwpIDIc0LSKftXO/RuUPsSsjMqN8QEOcBjSR3m+d 1JXvR2tPQhXvJpsnMT4QQtjZlC6A+5r6gDULMvNSgxEfUcz08eKS+xdCkJhTJOeGHxoS jeUFfhXPjoQYghn26u97i9ebT8WVPozQqWSrfVeoaQwS3zVnYvANlEh36GVjIkuaL4Kl XRpQ== X-Forwarded-Encrypted: i=1; AJvYcCUSKsipi0wTGEmQAxBB/aOoufnB70i5cWsB9BAJz2gImrX5lvNHcg/nHYvEBtkmvevR/FdgZcGYi4/ZpT+LeZnLd4pEH8avRGMvoBE8 X-Gm-Message-State: AOJu0YzE7ExELIPvQVXcpn0HyQ1r1XSVnk9QXAP5nKdTlB1/yOIb29sM xhvY8MaYp8M+gF9LaxxU41GhzSfua0bhqqqxZtIk/FYlmQzE2DXaiiFaQTtd76dw26s97bSjBI9 lHEJSm2G4a2GMcRytOHOqkF5KG2gGwVTbNAkM X-Received: by 2002:a05:622a:4812:b0:434:7bb9:f231 with SMTP id fb18-20020a05622a481200b004347bb9f231mr176338qtb.12.1712517103175; Sun, 07 Apr 2024 12:11:43 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240406164727.577914-1-visitorckw@gmail.com> <20240406164727.577914-14-visitorckw@gmail.com> In-Reply-To: <20240406164727.577914-14-visitorckw@gmail.com> From: Ian Rogers Date: Sun, 7 Apr 2024 12:11:31 -0700 Message-ID: Subject: Re: [PATCH v3 13/17] lib min_heap: Update min_heap_push() to use min_heap_sift_up() 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, linux-bcache@vger.kernel.org, linux-kernel@vger.kernel.org, dm-devel@lists.linux.dev, linux-bcachefs@vger.kernel.org, linux-perf-users@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Apr 6, 2024 at 9:48=E2=80=AFAM Kuan-Wei Chiu = wrote: > > Update min_heap_push() to use min_heap_sift_up() rather than its origin > inline version. > > Signed-off-by: Kuan-Wei Chiu Reviewed-by: Ian Rogers Thanks, Ian > --- > include/linux/min_heap.h | 9 +-------- > 1 file changed, 1 insertion(+), 8 deletions(-) > > diff --git a/include/linux/min_heap.h b/include/linux/min_heap.h > index 3086612d7cd5..fe037eb5952e 100644 > --- a/include/linux/min_heap.h > +++ b/include/linux/min_heap.h > @@ -190,7 +190,6 @@ bool __min_heap_push(min_heap_char *heap, const void = *element, size_t elem_size, > const struct min_heap_callbacks *func, void *args) > { > void *data =3D heap->data; > - void *child, *parent; > int pos; > > if (WARN_ONCE(heap->nr >=3D heap->size, "Pushing on a full heap")= ) > @@ -202,13 +201,7 @@ bool __min_heap_push(min_heap_char *heap, const void= *element, size_t elem_size, > heap->nr++; > > /* Sift child at pos up. */ > - for (; pos > 0; pos =3D (pos - 1) / 2) { > - child =3D data + (pos * elem_size); > - parent =3D data + ((pos - 1) / 2) * elem_size; > - if (func->less(parent, child, args)) > - break; > - func->swp(parent, child, args); > - } > + __min_heap_sift_up(heap, elem_size, pos, func, args); > > return true; > } > -- > 2.34.1 >