From patchwork Tue May 1 13:25:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Vorontsov X-Patchwork-Id: 8317 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 4073523E9A for ; Tue, 1 May 2012 13:27:20 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 08A76A1899F for ; Tue, 1 May 2012 13:27:19 +0000 (UTC) Received: by mail-iy0-f180.google.com with SMTP id e36so7605507iag.11 for ; Tue, 01 May 2012 06:27:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:date:from :to:cc:subject:message-id:references:mime-version:content-type :content-disposition:in-reply-to:user-agent:x-gm-message-state; bh=juUQAxAU9pOmp24q2ME+utUq/ThM1+Xmk8WBYu+3CeY=; b=fBal6RZ+iXvpfnjFFSAj8WR3UU7cF0RFJimkfwkU/YF0K0QNu344BlC6CT+4pGyj+4 1NunTSLKVYb+OFBkGsOLScp2323PrMtxmChYEKTUmQdMgpaeQLj7z6Lqq5yI1WYCIgbP 7UIMJ+BWstzyV+yIFY9nyAL18HPvVbDy0Ff0j57Guf+j8MxhJxv6lprsydqTLS/1qpJV P2s4glHoDkhXMnPKvyyF7tPFpvcf1jF0lTBm3JdtnJTRuYBtWp9tS1x2bUWXmUwvj3Au AqNRdORH3sXeeD2tYcOh9DX/rpEkhHVPgbeGXG/qczzMUXjY+Y4iNF46vGoekrZTtGN/ fzxQ== Received: by 10.42.122.76 with SMTP id m12mr6222313icr.38.1335878839810; Tue, 01 May 2012 06:27:19 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.137.198 with SMTP id x6csp180794ibt; Tue, 1 May 2012 06:27:19 -0700 (PDT) Received: by 10.68.134.232 with SMTP id pn8mr50574105pbb.106.1335878839216; Tue, 01 May 2012 06:27:19 -0700 (PDT) Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by mx.google.com with ESMTPS id p7si18305037pbk.314.2012.05.01.06.27.19 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 01 May 2012 06:27:19 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of anton.vorontsov@linaro.org) client-ip=209.85.160.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of anton.vorontsov@linaro.org) smtp.mail=anton.vorontsov@linaro.org Received: by pbcxa12 with SMTP id xa12so5766477pbc.37 for ; Tue, 01 May 2012 06:27:19 -0700 (PDT) Received: by 10.68.240.5 with SMTP id vw5mr9142528pbc.110.1335878838925; Tue, 01 May 2012 06:27:18 -0700 (PDT) Received: from localhost (c-71-204-165-222.hsd1.ca.comcast.net. [71.204.165.222]) by mx.google.com with ESMTPS id os8sm19291297pbc.14.2012.05.01.06.27.04 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 01 May 2012 06:27:05 -0700 (PDT) Date: Tue, 1 May 2012 06:25:45 -0700 From: Anton Vorontsov To: Pekka Enberg Cc: Leonid Moiseichuk , John Stultz , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linaro-kernel@lists.linaro.org, patches@linaro.org, kernel-team@android.com Subject: [PATCH 2/3] vmevent: Pass attr argument to sampling functions Message-ID: <20120501132544.GB24226@lizard> References: <20120501132409.GA22894@lizard> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20120501132409.GA22894@lizard> User-Agent: Mutt/1.5.21 (2010-09-15) X-Gm-Message-State: ALoCoQnoAaFLazcSfAdGIdSxwPuqWi50PHsceHm12yReku0+Xj6UvZwzn8faTzLa8pAPGXyggkb7 We'll need the argument for blended attributes, the attributes return either 0 or the threshold value (which is in attr). Signed-off-by: Anton Vorontsov --- mm/vmevent.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/mm/vmevent.c b/mm/vmevent.c index 9f1520b..b312236 100644 --- a/mm/vmevent.c +++ b/mm/vmevent.c @@ -39,9 +39,11 @@ struct vmevent_watch { wait_queue_head_t waitq; }; -typedef u64 (*vmevent_attr_sample_fn)(struct vmevent_watch *watch); +typedef u64 (*vmevent_attr_sample_fn)(struct vmevent_watch *watch, + struct vmevent_attr *attr); -static u64 vmevent_attr_swap_pages(struct vmevent_watch *watch) +static u64 vmevent_attr_swap_pages(struct vmevent_watch *watch, + struct vmevent_attr *attr) { #ifdef CONFIG_SWAP struct sysinfo si; @@ -54,12 +56,14 @@ static u64 vmevent_attr_swap_pages(struct vmevent_watch *watch) #endif } -static u64 vmevent_attr_free_pages(struct vmevent_watch *watch) +static u64 vmevent_attr_free_pages(struct vmevent_watch *watch, + struct vmevent_attr *attr) { return global_page_state(NR_FREE_PAGES); } -static u64 vmevent_attr_avail_pages(struct vmevent_watch *watch) +static u64 vmevent_attr_avail_pages(struct vmevent_watch *watch, + struct vmevent_attr *attr) { return totalram_pages; } @@ -74,7 +78,7 @@ static u64 vmevent_sample_attr(struct vmevent_watch *watch, struct vmevent_attr { vmevent_attr_sample_fn fn = attr_samplers[attr->type]; - return fn(watch); + return fn(watch, attr); } static bool vmevent_match(struct vmevent_watch *watch)