[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v5 4/8] mm: introduce a helper to get the memory type of a page
>>> On 17.08.18 at 12:17, <JBeulich@xxxxxxxx> wrote: >>>> On 14.08.18 at 15:43, <roger.pau@xxxxxxxxxx> wrote: >> + switch ( e820.map[i].type ) >> + { >> + case E820_RAM: >> + return RAM_TYPE_CONVENTIONAL; >> + >> + case E820_RESERVED: >> + return RAM_TYPE_RESERVED; >> + >> + case E820_UNUSABLE: >> + return RAM_TYPE_UNUSABLE; >> + >> + case E820_ACPI: >> + case E820_NVS: >> + return RAM_TYPE_ACPI; >> + >> + default: >> + ASSERT_UNREACHABLE(); >> + return -1; >> + } >> + } >> + >> + return -1; >> +} > > One more case to consider: What about a page part of which is > a given type, and the other part of which is simply missing from > the E820 table? I'm uncertain whether in that case it might be a > good idea in general to report it as having the given type; for the > specific purpose you want the function for, that would imo be > quite helpful. Considering RAM_TYPE_* are bit masks - perhaps the function should OR together all types found for the requested page, and let the caller go from there? And to account for my earlier remark, add a separate RAM_TYPE_UNKNOWN (and never have the function return -1 or some such; its return type then would better be unsigned int)? 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 |