From: Pekka Enberg <penberg@kernel.org>
To: Anton Vorontsov <anton.vorontsov@linaro.org>
Cc: John Stultz <john.stultz@linaro.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linaro-kernel@lists.linaro.org, patches@linaro.org
Subject: Re: [PATCH 2/3] vmevent: Factor vmevent_match_attr() out of vmevent_match()
Date: Fri, 12 Oct 2012 15:37:43 +0300 [thread overview]
Message-ID: <CAOJsxLFW3WbBDdFhuJDwUxvGVfsy_Tg8SpR4pxTWAcfQ+LG0UQ@mail.gmail.com> (raw)
In-Reply-To: <1349346078-24874-2-git-send-email-anton.vorontsov@linaro.org>
On Thu, Oct 4, 2012 at 1:21 PM, Anton Vorontsov
<anton.vorontsov@linaro.org> wrote:
> Soon we'll use this new function for other code; plus this makes code less
> indented.
>
> Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
> ---
> mm/vmevent.c | 107 +++++++++++++++++++++++++++++++----------------------------
> 1 file changed, 57 insertions(+), 50 deletions(-)
>
> diff --git a/mm/vmevent.c b/mm/vmevent.c
> index 39ef786..d434c11 100644
> --- a/mm/vmevent.c
> +++ b/mm/vmevent.c
> @@ -77,6 +77,59 @@ enum {
> VMEVENT_ATTR_STATE_VALUE_WAS_GT = (1UL << 31),
> };
>
> +static bool vmevent_match_attr(struct vmevent_attr *attr, u64 value)
> +{
> + u32 state = attr->state;
> + bool attr_lt = state & VMEVENT_ATTR_STATE_VALUE_LT;
> + bool attr_gt = state & VMEVENT_ATTR_STATE_VALUE_GT;
> + bool attr_eq = state & VMEVENT_ATTR_STATE_VALUE_EQ;
> + bool edge = state & VMEVENT_ATTR_STATE_EDGE_TRIGGER;
> + u32 was_lt_mask = VMEVENT_ATTR_STATE_VALUE_WAS_LT;
> + u32 was_gt_mask = VMEVENT_ATTR_STATE_VALUE_WAS_GT;
> + bool lt = value < attr->value;
> + bool gt = value > attr->value;
> + bool eq = value == attr->value;
> + bool was_lt = state & was_lt_mask;
> + bool was_gt = state & was_gt_mask;
[snip]
So I merged this patch but vmevent_match_attr() is still too ugly for
words. It really could use some serious cleanups.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2012-10-12 12:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-04 10:20 [PATCH 0/3] A few cleanups and refactorings, sync w/ upstream Anton Vorontsov
2012-10-04 10:21 ` [PATCH 1/3] vmevent: Remove unused code Anton Vorontsov
2012-10-04 10:21 ` [PATCH 2/3] vmevent: Factor vmevent_match_attr() out of vmevent_match() Anton Vorontsov
2012-10-12 12:37 ` Pekka Enberg [this message]
2012-10-12 22:21 ` Anton Vorontsov
2012-10-04 10:21 ` [PATCH 3/3] vmevent: Don't sample values twice Anton Vorontsov
2012-10-12 12:12 ` [PATCH 0/3] A few cleanups and refactorings, sync w/ upstream Pekka Enberg
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=CAOJsxLFW3WbBDdFhuJDwUxvGVfsy_Tg8SpR4pxTWAcfQ+LG0UQ@mail.gmail.com \
--to=penberg@kernel.org \
--cc=anton.vorontsov@linaro.org \
--cc=john.stultz@linaro.org \
--cc=linaro-kernel@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=patches@linaro.org \
/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