Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2894885rdh; Wed, 27 Sep 2023 16:51:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEc9EZrraGgVr77cSzRDpmWcw8BWtapHwJNl+SzJ8bKzVo+v7xHwQKNjZudSPr0BVnZLEKH X-Received: by 2002:a05:6a21:47cb:b0:160:7679:90 with SMTP id as11-20020a056a2147cb00b0016076790090mr3085741pzc.56.1695858673779; Wed, 27 Sep 2023 16:51:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695858673; cv=none; d=google.com; s=arc-20160816; b=lP+7a9K//kG3VCW3oBorF5cor+OmcMIxDa4nTYWW80p0NZJ9HNsAYyATFPHKUCBh90 6mPxmaQpTGsTS2erbm4/CFj3x/5Ge6qMqiOsHBvgxryE6WKrlii9fYXVmUAxGjNYGSYF ACDgOQGaUIm8KIzKRwTj3eE/MGhdlAb6FtILfJYGV3iW2zg9hIJI9E7CzJyjQpUR26I0 vwpRYnFnmQ/Jv2z85YpsIQmpDStfauvJhcnIuzDtU2PJectWdfNnH6lNBFno3gdE8Nfm OXHEL9z2zGnln15rKYD1comuD+g8fpP0lLOZyDVh0DYVZiNQjgHZHEqJidXSJ0JGyH0J 9sfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dkim-signature; bh=hz4HjlvMoyMlJFk+Px6NXXwtj0eY3c4mO7NnPf9aXgU=; fh=OlzZG5bbULpoZdXop4nOjTSPyGzKjBAu3uXiPCQdo8Y=; b=Zyfj7/vWuMAC7f081VixifwGv7kcjarbdwzLHSbmQyaP8Fx4N7cdooz43oTPyBLEdq 1SUlFS+sv0yrewqr3ShuOFv5suUxKJpQ6qPGW+vWAMkhJ20JX0mRRxaR1oiDQ4QQHJD8 bY/d2Em1TrhUFnHajlAPxvtdhwlHzQOj84kEp/g4lQm1yjdhFJ0tXV6LwKkKYhCwfQwl HigcjFnaPmjtNcdy0E7qGAdkHDIvggdLLgBF12qo5HBYr5Q/fMNP4kKxIUlWP8AOuIVu RQ0wFLyDr3VDYrT1M8F3Q4jCX3/KBMXT3oKKd7wdCxkbhGYVMly0Zh43SDS3sXEzLg0c zUBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Rf3OdmVH; 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=redhat.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id z8-20020a1709027e8800b001ae40e07fb0si11365287pla.216.2023.09.27.16.51.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 16:51:13 -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=@redhat.com header.s=mimecast20190719 header.b=Rf3OdmVH; 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=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 8C2A4806AFD8; Wed, 27 Sep 2023 13:26:07 -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 S229458AbjI0UZl (ORCPT + 99 others); Wed, 27 Sep 2023 16:25:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229771AbjI0UZi (ORCPT ); Wed, 27 Sep 2023 16:25:38 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C02C114 for ; Wed, 27 Sep 2023 13:24:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695846291; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=hz4HjlvMoyMlJFk+Px6NXXwtj0eY3c4mO7NnPf9aXgU=; b=Rf3OdmVH0F0pzrMSR+UHjxipJGzWs/MHm/Y5es1nuQpbP8/zmOBqWEr+QR2Yo/yMVL3H9e dBIZ9MSmQbnffJHVTIHQy8Nt4jrXPzbkqow2s1FofnnF0aWJYW8i1b0G7oueJS7N9Jkp8A OMe+E6vn2i0yKIEogWO940a4VqEFIoU= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-357-0xuIEUIYPXK84wg5g2ygQA-1; Wed, 27 Sep 2023 16:24:47 -0400 X-MC-Unique: 0xuIEUIYPXK84wg5g2ygQA-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E19F93C0DDA2; Wed, 27 Sep 2023 20:24:46 +0000 (UTC) Received: from RHTPC1VM0NT (unknown [10.22.10.131]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3F2E1492B16; Wed, 27 Sep 2023 20:24:46 +0000 (UTC) From: Aaron Conole To: Ilya Maximets Cc: netdev@vger.kernel.org, dev@openvswitch.org, linux-kernel@vger.kernel.org, Eric Dumazet , Jakub Kicinski , Paolo Abeni , "David S. Miller" Subject: Re: [ovs-dev] [PATCH net-next v2] openvswitch: reduce stack usage in do_execute_actions References: <20230921194314.1976605-1-i.maximets@ovn.org> Date: Wed, 27 Sep 2023 16:24:45 -0400 In-Reply-To: <20230921194314.1976605-1-i.maximets@ovn.org> (Ilya Maximets's message of "Thu, 21 Sep 2023 21:42:35 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** 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]); Wed, 27 Sep 2023 13:26:07 -0700 (PDT) Ilya Maximets writes: > do_execute_actions() function can be called recursively multiple > times while executing actions that require pipeline forking or > recirculations. It may also be re-entered multiple times if the packet > leaves openvswitch module and re-enters it through a different port. > > Currently, there is a 256-byte array allocated on stack in this > function that is supposed to hold NSH header. Compilers tend to > pre-allocate that space right at the beginning of the function: > > a88: 48 81 ec b0 01 00 00 sub $0x1b0,%rsp > > NSH is not a very common protocol, but the space is allocated on every > recursive call or re-entry multiplying the wasted stack space. > > Move the stack allocation to push_nsh() function that is only used > if NSH actions are actually present. push_nsh() is also a simple > function without a possibility for re-entry, so the stack is returned > right away. > > With this change the preallocated space is reduced by 256 B per call: > > b18: 48 81 ec b0 00 00 00 sub $0xb0,%rsp > > Signed-off-by: Ilya Maximets > --- Thanks, Ilya. Reviewed-by: Aaron Conole