From patchwork Mon Oct 23 16:22:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: andrey.konovalov@linux.dev X-Patchwork-Id: 156977 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1408680vqx; Mon, 23 Oct 2023 09:23:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH84NcS5epxhOUYPfmJODWPPk+WmO5R8rC2eJtuK/gOmye+M436yKwVN/y9rcc+Bkzzlu7w X-Received: by 2002:a17:903:18a:b0:1c9:cf26:8d91 with SMTP id z10-20020a170903018a00b001c9cf268d91mr8209867plg.8.1698078226071; Mon, 23 Oct 2023 09:23:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698078226; cv=none; d=google.com; s=arc-20160816; b=z0HdeSLURYucf9mJyJ+rFq54xlwVV7v6yd+igR7wJ9HvLbnM3FnUye+ZJo1afS0eMJ NJj0ERXQv7BV5M9p1onxTcLtKqCttRCWgv/5nPNazcSCo0wfXGTXyXBs69XK976uNuiN BdR0BXqQjzPPDXMp64jBkKlhOZ2NUv+qrJ2fCGanCabC50pY5cSNQCGYS+Zd/aD33ZCZ xwspoaAN8cFy+WI9J2tdBjOR02SdapIbC3sdfKUCwF/qqZ8+KjIB432Lp9ouZV/5SE+p LqIi5T6SvTJjT6pkhdtgCTIORLMXN/sHJ2sjbt/AK2H6ZqwwxqPRoqB1b+tO6znY9SyB ZMww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=eQriSK20/8KwwHOVdQKhz9C/zLOim8sff0QLVit0F7g=; fh=nfQSbTp1dWHt2Ier1Up8UhVNdXOqoJJLNvTrpT3jJEk=; b=nG+LC0UBPf42ZRoJpAQ40L89D9P4IT51y4qgC93SIzgd2JK3E8sd2Wt+sp1jdtl9hA PLmAoamtwFcDwJ8iSA/NAfXn3DQgWBOvH83sCh8ndN8PgoaiJ+s19RrNfcGFec9ZkRrW MhE8ll9tl/wBvcLyu2KWTchVA1XPrICTMZ1W0Gkah2pTnLFJ5SRMQCBLOTUk2Riiy0Cv KVXBhCESsHMBDCCtwIa71LgoLq4LcawegJdGnYLu0bDhFGyabMWJrVw0+cPbXV/NOGqY GKu+9Ek5j8tIRTgk+GoydEVL94V0aHP13Wqpu+u+2gKELo7lkUED46yI1FsXR857Qp+A bQTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="S/cthfh4"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id t23-20020a1709028c9700b001c3fa95ca03si6520661plo.9.2023.10.23.09.23.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 09:23:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="S/cthfh4"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 0AF9480B1230; Mon, 23 Oct 2023 09:23:44 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231827AbjJWQXX (ORCPT + 27 others); Mon, 23 Oct 2023 12:23:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232207AbjJWQXG (ORCPT ); Mon, 23 Oct 2023 12:23:06 -0400 Received: from out-208.mta0.migadu.com (out-208.mta0.migadu.com [91.218.175.208]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDFF1D79 for ; Mon, 23 Oct 2023 09:23:00 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1698078179; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eQriSK20/8KwwHOVdQKhz9C/zLOim8sff0QLVit0F7g=; b=S/cthfh4emQrjcVoGLkWqQT0OvtdGJAoIvLTqkDDKVckvqP8bUpXYF9LHT/z69ET7396wu VHNZOBPwORg5a49jPPMsPr93gE7IJt9XyYCBaDWrIFujMNX6hp01vXkIeQlmRKoXZZfyEN tUKjyZoUBaxEoZLynpfz1I7/Mg/7kMg= From: andrey.konovalov@linux.dev To: Marco Elver , Alexander Potapenko Cc: Andrey Konovalov , Dmitry Vyukov , Vlastimil Babka , kasan-dev@googlegroups.com, Evgenii Stepanov , Oscar Salvador , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH v3 03/19] lib/stackdepot: drop valid bit from handles Date: Mon, 23 Oct 2023 18:22:34 +0200 Message-Id: <5e251a589cb3142607ec5af8fcb904d424702a14.1698077459.git.andreyknvl@google.com> In-Reply-To: References: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 23 Oct 2023 09:23:44 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780564074174941443 X-GMAIL-MSGID: 1780564074174941443 From: Andrey Konovalov Stack depot doesn't use the valid bit in handles in any way, so drop it. Reviewed-by: Alexander Potapenko Signed-off-by: Andrey Konovalov --- lib/stackdepot.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/stackdepot.c b/lib/stackdepot.c index 0772125efe8a..482eac40791e 100644 --- a/lib/stackdepot.c +++ b/lib/stackdepot.c @@ -32,13 +32,12 @@ #define DEPOT_HANDLE_BITS (sizeof(depot_stack_handle_t) * 8) -#define DEPOT_VALID_BITS 1 #define DEPOT_POOL_ORDER 2 /* Pool size order, 4 pages */ #define DEPOT_POOL_SIZE (1LL << (PAGE_SHIFT + DEPOT_POOL_ORDER)) #define DEPOT_STACK_ALIGN 4 #define DEPOT_OFFSET_BITS (DEPOT_POOL_ORDER + PAGE_SHIFT - DEPOT_STACK_ALIGN) -#define DEPOT_POOL_INDEX_BITS (DEPOT_HANDLE_BITS - DEPOT_VALID_BITS - \ - DEPOT_OFFSET_BITS - STACK_DEPOT_EXTRA_BITS) +#define DEPOT_POOL_INDEX_BITS (DEPOT_HANDLE_BITS - DEPOT_OFFSET_BITS - \ + STACK_DEPOT_EXTRA_BITS) #define DEPOT_POOLS_CAP 8192 #define DEPOT_MAX_POOLS \ (((1LL << (DEPOT_POOL_INDEX_BITS)) < DEPOT_POOLS_CAP) ? \ @@ -50,7 +49,6 @@ union handle_parts { struct { u32 pool_index : DEPOT_POOL_INDEX_BITS; u32 offset : DEPOT_OFFSET_BITS; - u32 valid : DEPOT_VALID_BITS; u32 extra : STACK_DEPOT_EXTRA_BITS; }; }; @@ -303,7 +301,6 @@ depot_alloc_stack(unsigned long *entries, int size, u32 hash, void **prealloc) stack->size = size; stack->handle.pool_index = pool_index; stack->handle.offset = pool_offset >> DEPOT_STACK_ALIGN; - stack->handle.valid = 1; stack->handle.extra = 0; memcpy(stack->entries, entries, flex_array_size(stack, entries, size)); pool_offset += required_size;