From: Bagas Sanjaya <bagasdotme@gmail.com>
To: Dave Tucker <dave@dtucker.co.uk>
Cc: bpf@vger.kernel.org, corbet@lwn.net, ast@kernel.org,
daniel@iogearbox.net, andrii@kernel.org, kafai@fb.com,
songliubraving@fb.com, john.fastabend@gmail.com,
kpsingh@kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH v4 bpf-next 2/2] bpf, docs: document BPF_MAP_TYPE_ARRAY
Date: Fri, 1 Jul 2022 10:26:25 +0700 [thread overview]
Message-ID: <Yr5pYWg2YSyVgdqA@debian.me> (raw)
In-Reply-To: <ca8a57db17da57f403b029c14ba4f0b89774d361.1656590177.git.dave@dtucker.co.uk>
On Thu, Jun 30, 2022 at 01:04:09PM +0100, Dave Tucker wrote:
> This commit adds documentation for the BPF_MAP_TYPE_ARRAY including
> kernel version introduced, usage and examples.
> It also documents BPF_MAP_TYPE_PERCPU_ARRAY since this is similar.
>
Use imperative mood instead of descriptive one for patch description.
> Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
> ---
> Documentation/bpf/map_array.rst | 183 ++++++++++++++++++++++++++++++++
> 1 file changed, 183 insertions(+)
> create mode 100644 Documentation/bpf/map_array.rst
>
> diff --git a/Documentation/bpf/map_array.rst b/Documentation/bpf/map_array.rst
> new file mode 100644
> index 000000000000..eadc714591d2
> --- /dev/null
> +++ b/Documentation/bpf/map_array.rst
> @@ -0,0 +1,183 @@
> +.. SPDX-License-Identifier: GPL-2.0-only
> +.. Copyright (C) 2021 Red Hat, Inc.
> +
> +================================================
> +BPF_MAP_TYPE_ARRAY and BPF_MAP_TYPE_PERCPU_ARRAY
> +================================================
> +
> +.. note:: ``BPF_MAP_TYPE_ARRAY`` was introduced in Kernel version 3.19 and
> + ``BPF_MAP_TYPE_PERCPU_ARRAY`` in version 4.6
> +
nit: s/Kernel/kernel/
> +Since Kernel 5.4, memory mapping may be enabled for ``BPF_MAP_TYPE_ARRAY`` by
> +setting the flag ``BPF_F_MMAPABLE``. The map definition is page-aligned and
> +starts on the first page. Sufficient page-sized and page-aligned blocks of
> +memory are allocated to store all array values, starting on the second page,
> +which in some cases will result in over-allocation of memory. The benefit of
> +using this is increased performance and ease of use since userspace programs
> +would not be required to use helper functions to access and mutate data.
> +
same nit above
> +Examples
> +========
> +
> +Please see the `tools/testing/selftests/bpf`_ directory for functional examples.
> +This sample code simply demonstrates the API.
Shouldn't the examples in this doc be put somewhere else in the tree? Or
where do they come from?
> +
> +.. section links
> +.. _tools/testing/selftests/bpf:
> + https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/testing/selftests/bpf
I think the link isn't needed, since kernel developers will simply look at
their own tree instead.
Thanks.
--
An old man doll... just what I always wanted! - Clara
next prev parent reply other threads:[~2022-07-01 3:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-30 12:04 [PATCH v4 bpf-next 0/2] bpf, docs: Document BPF_MAP_TYPE_ARRAY Dave Tucker
2022-06-30 12:04 ` [PATCH v4 bpf-next 1/2] bpf, docs: add kernel version to map_cgroup_storage Dave Tucker
2022-07-01 2:10 ` Bagas Sanjaya
2022-06-30 12:04 ` [PATCH v4 bpf-next 2/2] bpf, docs: document BPF_MAP_TYPE_ARRAY Dave Tucker
2022-06-30 13:31 ` Jonathan Corbet
2022-07-01 3:26 ` Bagas Sanjaya [this message]
2022-07-04 10:39 ` Donald Hunter
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=Yr5pYWg2YSyVgdqA@debian.me \
--to=bagasdotme@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=corbet@lwn.net \
--cc=daniel@iogearbox.net \
--cc=dave@dtucker.co.uk \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=songliubraving@fb.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).