[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v5 3/4] mm: make MEMF_no_refcount pages safe to assign
On 29.01.2020 11:16, Paul Durrant wrote: > --- a/xen/common/page_alloc.c > +++ b/xen/common/page_alloc.c > @@ -2287,11 +2287,14 @@ int assign_pages( > > for ( i = 0; i < (1 << order); i++ ) > { > + unsigned long count_info = pg[i].count_info; > + > ASSERT(page_get_owner(&pg[i]) == NULL); > - ASSERT(!pg[i].count_info); > + ASSERT(!(count_info & ~PGC_no_refcount)); I think this would benefit from being more strict: The flag may also not be set if MEMF_no_refcount is clear in the flags passed in. > @@ -2334,11 +2332,20 @@ struct page_info *alloc_domheap_pages( > memflags, d)) == NULL)) ) > return NULL; > > - if ( d && !(memflags & MEMF_no_owner) && > - assign_pages(d, pg, order, memflags) ) > + if ( d && !(memflags & MEMF_no_owner) ) > { > - free_heap_pages(pg, order, memflags & MEMF_no_scrub); > - return NULL; > + if ( memflags & MEMF_no_refcount ) > + { > + unsigned long i; With this you mean ... > + for ( i = 0; i < (1 << order); i++ ) ... 1UL here. Or else "unsigned int" and 1U. The file isn't very consistent with this, but at least locally to a single functions things should match up. Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |