lkml.org 
[lkml]   [2023]   [Oct]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRe: [PATCH 09/13] x86/tdx: Account shared memory
    Date

    > +#ifdef CONFIG_DEBUG_FS
    > +static int tdx_shared_memory_show(struct seq_file *m, void *p)
    > +{
    > + unsigned long addr, end;
    > + unsigned long found = 0;
    > +
    > + addr = PAGE_OFFSET;
    > + end = PAGE_OFFSET + get_max_mapped();
    > +
    > + while (addr < end) {
    > + unsigned long size;
    > + unsigned int level;
    > + pte_t *pte;
    > +
    > + pte = lookup_address(addr, &level);
    > + size = page_level_size(level);
    > +
    > + if (pte && pte_decrypted(*pte))
    > + found += size / PAGE_SIZE;
    > +
    > + addr += size;

    This could be a long loop, perhaps add cond_resched() here?

    > + }
    > +
    > + seq_printf(m, "Number of unshared pages in kernel page tables: %16lu\n",
    > + found);
    > + seq_printf(m, "Number of pages accounted as unshared: %16ld\n",
    > + atomic_long_read(&nr_shared));
    > + return 0;
    > +}
    > +

    \
     
     \ /
      Last update: 2023-10-10 12:05    [W:4.254 / U:0.168 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site