Linux LVM users
 help / color / mirror / Atom feed
From: Daniel Stodden <daniel.stodden@citrix.com>
To: Alasdair G Kergon <agk@redhat.com>
Cc: Linux LVM <linux-lvm@redhat.com>
Subject: Re: [PATCH2] [linux-lvm] vgchange -a memory consumption
Date: Wed, 16 Jul 2008 13:39:57 -0700	[thread overview]
Message-ID: <1216240797.18076.9.camel@smithers> (raw)
In-Reply-To: <20080716174240.GN7155@agk.fab.redhat.com>

[-- Attachment #1: Type: text/plain, Size: 584 bytes --]


Hi.

On Wed, 2008-07-16 at 18:42 +0100, Alasdair G Kergon wrote:
> Quick way for starters, is allocate a pointless object in the pool
> then free eveything back to that point each time round the loop.
> 
> But proper thing is to track down into the library and find
> which routines are the ones where the pool can be freed at
> the end and isn't being.
> 
> IOW where are most of those allocations happening?
> 
> Alasdair

Okay. Unless we really find a better way to do it, here is the suggested marker version.

As far as I can tell so far, this works equally well.

Best,
Daniel

[-- Attachment #2: lvm2-vgchange-mem.diff --]
[-- Type: text/x-patch, Size: 780 bytes --]

diff -r f79956e87d1d -r 6a69ebd5ade1 tools/vgchange.c
--- a/tools/vgchange.c	Mon Jul 14 18:16:03 2008 -0700
+++ b/tools/vgchange.c	Wed Jul 16 13:15:32 2008 -0700
@@ -57,10 +57,17 @@ static int _activate_lvs_in_vg(struct cm
 	struct lv_list *lvl;
 	struct logical_volume *lv;
 	const char *pvname;
+	void *marker;
 	int count = 0;
 
 	list_iterate_items(lvl, &vg->lvs) {
 		lv = lvl->lv;
+
+		marker = dm_pool_alloc(cmd->mem, 1);
+		if (!marker) {
+			log_error("Out of memory");
+			return count;
+		}
 
 		/* Only request activation of snapshot origin devices */
 		if ((lv->status & SNAPSHOT) || lv_is_cow(lv))
@@ -98,6 +105,8 @@ static int _activate_lvs_in_vg(struct cm
 			pvmove_poll(cmd, pvname, 1);
 			continue;
 		}
+
+		dm_pool_free(cmd->mem, marker);
 
 		count++;
 	}

      parent reply	other threads:[~2008-07-16 20:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-12  5:57 [linux-lvm] vgchange -a memory consumption Daniel Stodden
2008-07-12 16:51 ` Alasdair G Kergon
2008-07-15  6:19   ` Daniel Stodden
2008-07-16 16:48     ` [PATCH] " Daniel Stodden
     [not found]       ` <20080716165243.GM7155@agk.fab.redhat.com>
     [not found]         ` <1216228176.1130.13.camel@desktop>
     [not found]           ` <20080716174240.GN7155@agk.fab.redhat.com>
     [not found]             ` <1216231344.16876.25.camel@desktop>
2008-07-16 18:08               ` Daniel Stodden
2008-07-16 20:39             ` Daniel Stodden [this message]

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=1216240797.18076.9.camel@smithers \
    --to=daniel.stodden@citrix.com \
    --cc=agk@redhat.com \
    --cc=linux-lvm@redhat.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