All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Fabio M. De Francesco" <fmdefrancesco@gmail.com>
To: outreachy@lists.linux.dev, Jaehee Park <jhpark1013@gmail.com>
Subject: Re: patch idea for wfx
Date: Thu, 31 Mar 2022 19:40:54 +0200	[thread overview]
Message-ID: <2109950.Mh6RI2rZIc@leap> (raw)
In-Reply-To: <20220331141434.GA1104155@jaehee-ThinkPad-X1-Extreme>

On gioved? 31 marzo 2022 16:14:34 CEST Jaehee Park wrote:
>
> [...]
>
> I'm not entirely sure why container_of structure is helpful. But this article seems to say it makes runtime faster: http://www.kroah.com/log/linux/container_of.html

Hi Jaehee,

container_of() is widely used in Linux kernel code. It's a macro whose purpose
is to return the address of the struct that contains a given field. Users pass 
a pointer to the field, the name of the struct, and the name of the field and 
it returns a pointer to the embedding struct.

It's faster than other means because it's a macro that makes subtractions on 
pointers.

Many in-kernel data structures, like the doubly linked lists API, use it for
convenience and type safety.

Regards,

Fabio M. De Francesco



  reply	other threads:[~2022-03-31 17:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-31 14:14 patch idea for wfx Jaehee Park
2022-03-31 17:40 ` Fabio M. De Francesco [this message]
2022-03-31 17:52 ` Stefano Brivio
2022-03-31 21:47   ` Jaehee Park
2022-03-31 22:12     ` Stefano Brivio
2022-04-06  4:28       ` Jaehee Park
2022-04-06 13:54         ` Fabio M. De Francesco
2022-04-06 14:24           ` Jaehee Park
2022-04-06 16:04             ` Fabio M. De Francesco
2022-04-07  1:57               ` Jaehee Park
2022-04-06 15:41         ` Stefano Brivio

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=2109950.Mh6RI2rZIc@leap \
    --to=fmdefrancesco@gmail.com \
    --cc=jhpark1013@gmail.com \
    --cc=outreachy@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.