Messages in this thread | | | Date | Tue, 2 Aug 2005 13:16:53 +0300 | From | Pekka Enberg <> | Subject | Re: [PATCH 00/14] GFS |
| |
Hi David,
On 8/2/05, David Teigland <teigland@redhat.com> wrote: > Hi, GFS (Global File System) is a cluster file system that we'd like to > see added to the kernel. The 14 patches total about 900K so I won't send > them to the list unless that's requested. Comments and suggestions are > welcome. Thanks
> +#define kmalloc_nofail(size, flags) \ > + gmalloc_nofail((size), (flags), __FILE__, __LINE__)
[snip]
> +void *gmalloc_nofail_real(unsigned int size, int flags, char *file, > + unsigned int line) > +{ > + void *x; > + for (;;) { > + x = kmalloc(size, flags); > + if (x) > + return x; > + if (time_after_eq(jiffies, gfs2_malloc_warning + 5 * HZ)) { > + printk("GFS2: out of memory: %s, %u\n", > + __FILE__, __LINE__); > + gfs2_malloc_warning = jiffies; > + } > + yield();
This does not belong in a filesystem. It also seems like a very bad idea. What are you trying to do here? If you absolutely must not fail, use __GFP_NOFAIL instead.
> + } > +} > + > +#if defined(GFS2_MEMORY_SIMPLE) > + > +atomic_t gfs2_memory_count; > + > +void gfs2_memory_add_i(void *data, char *file, unsigned int line) > +{ > + atomic_inc(&gfs2_memory_count); > +} > + > +void gfs2_memory_rm_i(void *data, char *file, unsigned int line) > +{ > + if (data) > + atomic_dec(&gfs2_memory_count); > +} > + > +void *gmalloc(unsigned int size, int flags, char *file, unsigned int line) > +{ > + void *data = kmalloc(size, flags); > + if (data) > + atomic_inc(&gfs2_memory_count); > + return data; > +} > + > +void *gmalloc_nofail(unsigned int size, int flags, char *file, > + unsigned int line) > +{ > + atomic_inc(&gfs2_memory_count); > + return gmalloc_nofail_real(size, flags, file, line); > +} > + > +void gfree(void *data, char *file, unsigned int line) > +{ > + if (data) { > + atomic_dec(&gfs2_memory_count); > + kfree(data); > + } > +}
-mm has memory leak detection patches and there are others floating around. Please do not introduce yet another subsystem-specific debug allocator.
Pekka - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |