[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] mm/pdx: Add comments throughout the codebase for pdx


  • To: Alejandro Vallejo <alejandro.vallejo@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 22 Jun 2023 15:28:14 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=692S3r+mqE6hNQI/RE0P7FIlwajyYHYijfj1K8vRx8I=; b=Ej9tL4nMM2KJ+TBTDKDs1EcfsxvHyDnyC92ddz9Ug9muqkVnL4P0i55D8Vn1u3Bcl1Vh2Bqvb/jqHFDccAAn7LlJXzSk738vtwobZ9iCsmlytsYCEFSkiJlrubdUMhmH/mXPzsXHyQZT9DKoCm56Ev/cMRt3i2LxGY5zxgKXm3ZSGT6RkLUq2BtupSLH2ncaQ7BHsmps7gCOdCpuprVEbM8trL/UyOAfLOzhBNKcn1ezDboYRSS2ylO4JEkT76WhXsU5QzWhGREuGeLd21q36CjzLZ56Y0TdWr9GsUt6sJF/ZsghPl7uDpckF2DkfFvfQHqoNKiZudrCNq7FNvGn8A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W+b0cvvydixY+w7TvouFoJxUoYH6tXTUhpTOUdoHwiO6V7+FYQyeite0pVy0FGVA27BsfrkRTHWQDt8i/yQO7h9oTdd9V97O40gQjvnrFZEM1If01B6oF4vkfcWMr60NR+i3mjLTlXPijwUHKC7xdTo5eBmLWeKjnjCmudGblVwP5vfnrD7JRI1eiUTT45qVaSlTVhe2jlFt0Co9h0O7PLXpxUXFYbYVBwgtXzvyNpJ9n21XUNoS7YpFhTFL5fXQN3XwNHT4VmwwL0tV6bje4A7nlK3ZY5aZB3dWpHnI4AU2NZWMqoMj8fx43csl1z9NTj8WdD/qGRwVGkAGxoMezg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 22 Jun 2023 13:28:32 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 22.06.2023 14:39, Alejandro Vallejo wrote:
> On Thu, Jun 22, 2023 at 11:15:17AM +0200, Jan Beulich wrote:
>>>>> + * This is a technique to avoid wasting memory on machines known to have
>>>>> + * split their machine address space in two big discontinuous and highly
>>>>> + * disjoint chunks.
>>>>
>>>> Why two? There can be any number, and in fact on the system I originally
>>>> had data from for reference (when first writing this code) iirc there
>>>> were 8 nodes, each with a chunk of memory far away from the other chunks.
>>>> The compression scheme used merely requires that some "inner" bits are
>>>> unused (always zero) in all of those ranges.
>>> Well, our implementation only supports two and I didn't see any obvious
>>> hints about intending to increasing that number.
>>
>> Where are you taking that "supports two" from? When I first wrote this code,
>> it was tested against a system with 8 (maybe it was 4, but certainly more
>> than 2) discontiguous regions (not counting the hole below 4G).
> You can have any number, but there's a single contiguous bit slice being
> removed, as far as I can see. The adaptor functions in
> xen/include/xen/pdx.h perform a single shift.
> 
>     static inline unsigned long pfn_to_pdx(unsigned long pfn)
>     {
>         return (pfn & pfn_pdx_bottom_mask) |
>                ((pfn & pfn_top_mask) >> pfn_pdx_hole_shift);
>     }
> 
>     static inline unsigned long pdx_to_pfn(unsigned long pdx)
>     {
>         return (pdx & pfn_pdx_bottom_mask) |
>                ((pdx << pfn_pdx_hole_shift) & pfn_top_mask);
>     }
> 
> Unless I'm missing some non-obvious piece of the puzzle, I'd say that for a
> truly general compressor we'd need some kind of loop over the hole mask.

Well, further compression might be possible that way, yes, but that's
entirely orthogonal to the number of discontiguous regions we're
talking about. Consider

0x0000100000000000-0x00001000ffffffff
0x0000200000000000-0x00002000ffffffff
0x0000300000000000-0x00003000ffffffff
0x0000400000000000-0x00004000ffffffff

The reference system's arrangement was slightly more complex (first and
foremost because of the memory below 4G that node 0 had), but came close
to the above conceptually.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.