[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v4 2/4] x86/mem_sharing: copy a page_lock version to be internal to memshr
>>> On 03.05.19 at 15:43, <tamas@xxxxxxxxxxxxx> wrote: > On Fri, May 3, 2019 at 2:27 AM Jan Beulich <JBeulich@xxxxxxxx> wrote: >> >> >>> On 03.05.19 at 00:13, <tamas@xxxxxxxxxxxxx> wrote: >> > --- a/xen/arch/x86/mm/mem_sharing.c >> > +++ b/xen/arch/x86/mm/mem_sharing.c >> > @@ -112,13 +112,48 @@ static inline void page_sharing_dispose(struct >> > page_info *page) >> > >> > #endif /* MEM_SHARING_AUDIT */ >> > >> > -static inline int mem_sharing_page_lock(struct page_info *pg) >> > +/* >> > + * Private implementations of page_lock/unlock to bypass PV-only >> > + * sanity checks not applicable to mem-sharing. >> > + */ >> > +static inline bool _page_lock(struct page_info *page) >> > { >> > - int rc; >> > + unsigned long x, nx; >> > + >> > + do { >> > + while ( (x = page->u.inuse.type_info) & PGT_locked ) >> > + cpu_relax(); >> > + nx = x + (1 | PGT_locked); >> > + if ( !(x & PGT_validated) || >> > + !(x & PGT_count_mask) || >> > + !(nx & PGT_count_mask) ) >> > + return false; >> >> Just for my own understanding: Did you verify that the PGT_validated >> check is indeed needed here, or did you copy it "just in case"? In the >> latter case a comment may be worthwhile. > > This is an exact copy of page_lock, sans the asserts that break it > from mem_sharing. I didn't investigate which of these flags are > necessary for mem_sharing. Frankly, I don't fully understand their > meaning and I haven't came across documentation about it yet. I can > certainly add a comment saying TODO: figure out which of these flags > are actually needed. Yes something along these lines is what I'm after. But "these flags" really is just PGT_validated. There's no question the PGT_locked and PGT_count_mask operations need to remain as they are. 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 |