Re: [PATCH 5/8] Protectable Memory

2018-03-14 Thread J Freyensee
+struct pmalloc_data { + struct gen_pool *pool; /* Link back to the associated pool. */ + bool protected; /* Status of the pool: RO or RW. */ + struct kobj_attribute attr_protected; /* Sysfs attribute. */ + struct kobj_attribute attr_avail; /* Sysfs attribute.

Re: [PATCH 5/8] Protectable Memory

2018-03-14 Thread J Freyensee
+struct pmalloc_data { + struct gen_pool *pool; /* Link back to the associated pool. */ + bool protected; /* Status of the pool: RO or RW. */ + struct kobj_attribute attr_protected; /* Sysfs attribute. */ + struct kobj_attribute attr_avail; /* Sysfs attribute.

Re: [PATCH 5/8] Protectable Memory

2018-03-14 Thread Igor Stoppa
On 14/03/18 14:15, Matthew Wilcox wrote: > On Tue, Mar 13, 2018 at 11:45:51PM +0200, Igor Stoppa wrote: >> +static inline void *pmalloc_array(struct gen_pool *pool, size_t n, >> + size_t size, gfp_t flags) >> +{ >> +if (unlikely(!(pool && n && size))) >> +

Re: [PATCH 5/8] Protectable Memory

2018-03-14 Thread Igor Stoppa
On 14/03/18 14:15, Matthew Wilcox wrote: > On Tue, Mar 13, 2018 at 11:45:51PM +0200, Igor Stoppa wrote: >> +static inline void *pmalloc_array(struct gen_pool *pool, size_t n, >> + size_t size, gfp_t flags) >> +{ >> +if (unlikely(!(pool && n && size))) >> +

Re: [PATCH 5/8] Protectable Memory

2018-03-14 Thread Matthew Wilcox
On Tue, Mar 13, 2018 at 11:45:51PM +0200, Igor Stoppa wrote: > +static inline void *pmalloc_array(struct gen_pool *pool, size_t n, > + size_t size, gfp_t flags) > +{ > + if (unlikely(!(pool && n && size))) > + return NULL; Why not use the same formula

Re: [PATCH 5/8] Protectable Memory

2018-03-14 Thread Matthew Wilcox
On Tue, Mar 13, 2018 at 11:45:51PM +0200, Igor Stoppa wrote: > +static inline void *pmalloc_array(struct gen_pool *pool, size_t n, > + size_t size, gfp_t flags) > +{ > + if (unlikely(!(pool && n && size))) > + return NULL; Why not use the same formula

[PATCH 5/8] Protectable Memory

2018-03-13 Thread Igor Stoppa
The MMU available in many systems running Linux can often provide R/O protection to the memory pages it handles. However, the MMU-based protection works efficiently only when said pages contain exclusively data that will not need further modifications. Statically allocated variables can be

[PATCH 5/8] Protectable Memory

2018-03-13 Thread Igor Stoppa
The MMU available in many systems running Linux can often provide R/O protection to the memory pages it handles. However, the MMU-based protection works efficiently only when said pages contain exclusively data that will not need further modifications. Statically allocated variables can be