netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>
To: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>,
	Ira Weiny <ira.weiny@intel.com>
Cc: Alexander Duyck <alexander.duyck@gmail.com>,
	Jakub Kicinski <kuba@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Netdev <netdev@vger.kernel.org>,
	Maciej Fijalkowski <maciej.fijalkowski@intel.com>,
	Jesper Dangaard Brouer <hawk@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	intel-wired-lan <intel-wired-lan@lists.osuosl.org>,
	Alexander Duyck <alexanderduyck@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	Jesse Brandeburg <jesse.brandeburg@intel.com>,
	Alexei Starovoitov <ast@kernel.org>, bpf <bpf@vger.kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Tony Nguyen <anthony.l.nguyen@intel.com>
Subject: Re: [Intel-wired-lan] [PATCH] ixgbe: Use kmap_local_page in ixgbe_check_lbtest_frame()
Date: Sat, 01 Oct 2022 00:03:24 +0200	[thread overview]
Message-ID: <832292081.0ifERbkFSE@localhost.localdomain> (raw)
In-Reply-To: <27280395.gRfpFWEtPU@localhost.localdomain>

On Friday, September 23, 2022 5:05:43 PM CEST Fabio M. De Francesco wrote:
> Hi Anirudh,
> 
> On Friday, September 23, 2022 12:38:02 AM CEST Anirudh Venkataramanan wrote:
> > On 9/22/2022 1:58 PM, Alexander Duyck wrote:
> > > On Thu, Sep 22, 2022 at 1:07 PM Anirudh Venkataramanan
> > > <anirudh.venkataramanan@intel.com> wrote:

[snip]

> > Is using page_address() directly beneficial in some way?
> 
> A possible call chain on 32 bits kernels is the following:
> 
> kmap_local_page() ->
>  __kmap_local_page_prot() { 
> 	if (!IS_ENABLED(CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAP) && |
> PageHighMem(page))
> 		return page_address(page);
> 
> ....
> }
> 
> How many instructions can you save calling page_address() directly?
> If you don't know, look at the assembly.

I just realized that perhaps you were expecting something like either "No, it 
is not directly beneficial because []" or "Yes, it is directly beneficial 
because []".

Instead, I used a rhetoric question that might not have been so clear as I 
thought. This kind of construct is so largely used in my native language, that 
nobody might misunderstand. I'm not so sure if it is the same in English.

I mean, are those dozen "unnecessary" further assembly instructions too many 
or too few to care about? I _think_ that they are too many.

Therefore, by showing a possible call chain in 32 bits architectures, I 
indirectly responded "no, I can't see any direct benefit", at least because....

1) Whatever the architecture, if pages can't come from Highmem, code always 
ends up calling page_address(). In 32 bits archs they waste precious kernel 
stack space (a scarce resources) only to build two stack frames (one per each 
called functions).

 2) Developers adds further work to the CPU and force the kernel to run 
unnecessary code.

I'll always use page_address() when I can "prove" that the allocation cannot 
come from ZONE_HIGHMEM.

Thanks,

Fabio




  parent reply	other threads:[~2022-09-30 22:03 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-29  8:58 [PATCH] ixgbe: Use kmap_local_page in ixgbe_check_lbtest_frame() Fabio M. De Francesco
2022-06-30 10:10 ` Maciej Fijalkowski
2022-06-30 15:17   ` [Intel-wired-lan] " Alexander Duyck
2022-06-30 15:21     ` Maciej Fijalkowski
2022-06-30 15:25     ` Eric Dumazet
2022-06-30 16:09       ` Alexander Duyck
2022-06-30 18:18         ` Fabio M. De Francesco
2022-06-30 21:59           ` Alexander Duyck
2022-07-01 15:36             ` Fabio M. De Francesco
2022-09-22 20:07               ` Anirudh Venkataramanan
2022-09-22 20:58                 ` Alexander Duyck
2022-09-22 22:38                   ` Anirudh Venkataramanan
2022-09-23 15:05                     ` Fabio M. De Francesco
2022-09-23 17:59                       ` Anirudh Venkataramanan
2022-09-30 22:03                       ` Fabio M. De Francesco [this message]
2022-09-23 15:31                     ` Alexander Duyck
2022-09-23 18:50                       ` Anirudh Venkataramanan
2022-09-23 21:31                         ` Alexander Duyck
2022-06-30 18:13     ` Fabio M. De Francesco
2022-08-04 12:53 ` G, GurucharanX

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=832292081.0ifERbkFSE@localhost.localdomain \
    --to=fmdefrancesco@gmail.com \
    --cc=alexander.duyck@gmail.com \
    --cc=alexanderduyck@fb.com \
    --cc=anirudh.venkataramanan@intel.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=ira.weiny@intel.com \
    --cc=jesse.brandeburg@intel.com \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maciej.fijalkowski@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).