From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Yang Shi <yang.shi@linux.alibaba.com>
Cc: kirill.shutemov@linux.intel.com, hughd@google.com,
aarcange@redhat.com, akpm@linux-foundation.org,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [linux-next PATCH 1/2] mm: khugepaged: add exceed_max_ptes_* helpers
Date: Fri, 1 May 2020 00:59:32 +0300 [thread overview]
Message-ID: <20200430215932.5w5dck3rnieppzqa@box> (raw)
In-Reply-To: <1588200982-69492-1-git-send-email-yang.shi@linux.alibaba.com>
On Thu, Apr 30, 2020 at 06:56:21AM +0800, Yang Shi wrote:
> The max_ptes_{swap|none|shared} are defined to tune the behavior of
> khugepaged. The are checked at a couple of places with open coding.
> Replace the opencoding to exceed_pax_ptes_{swap|none_shared} helpers to
> improve the readability.
>
> Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> Cc: Hugh Dickins <hughd@google.com>
> Cc: Andrea Arcangeli <aarcange@redhat.com>
> Signed-off-by: Yang Shi <yang.shi@linux.alibaba.com>
> ---
> mm/khugepaged.c | 27 +++++++++++++++++++++------
> 1 file changed, 21 insertions(+), 6 deletions(-)
>
> diff --git a/mm/khugepaged.c b/mm/khugepaged.c
> index a02a4c5..0c8d30b 100644
> --- a/mm/khugepaged.c
> +++ b/mm/khugepaged.c
> @@ -339,6 +339,21 @@ struct attribute_group khugepaged_attr_group = {
> };
> #endif /* CONFIG_SYSFS */
>
> +static inline bool exceed_max_ptes_none(unsigned int *nr_ptes)
> +{
> + return (++(*nr_ptes) > khugepaged_max_ptes_none);
> +}
> +
> +static inline bool exceed_max_ptes_swap(unsigned int *nr_ptes)
> +{
> + return (++(*nr_ptes) > khugepaged_max_ptes_swap);
> +}
> +
> +static inline bool exceed_max_ptes_shared(unsigned int *nr_ptes)
> +{
> + return (++(*nr_ptes) > khugepaged_max_ptes_shared);
> +}
> +
Frankly, I find this ugly and confusing. Open-coded version is more
readable to me.
--
Kirill A. Shutemov
next prev parent reply other threads:[~2020-04-30 21:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-29 22:56 Yang Shi
2020-04-29 22:56 ` [linux-next PATCH 2/2] mm: khugepaged: don't have to put being freed page back to lru Yang Shi
2020-04-30 0:41 ` Yang Shi
2020-04-30 0:47 ` Yang Shi
2020-04-30 21:59 ` Kirill A. Shutemov [this message]
2020-04-30 23:59 ` [linux-next PATCH 1/2] mm: khugepaged: add exceed_max_ptes_* helpers Yang Shi
2020-05-01 1:09 ` Hugh Dickins
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=20200430215932.5w5dck3rnieppzqa@box \
--to=kirill@shutemov.name \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=yang.shi@linux.alibaba.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