[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6d57c534-5696-e7a2-4b97-5521afcd072a@linux.intel.com>
Date: Mon, 5 Mar 2018 13:50:26 -0800
From: Dave Hansen <dave.hansen@...ux.intel.com>
To: Khalid Aziz <khalid.aziz@...cle.com>, davem@...emloft.net,
akpm@...ux-foundation.org
Cc: corbet@....net, bob.picco@...cle.com, steven.sistare@...cle.com,
pasha.tatashin@...cle.com, mike.kravetz@...cle.com,
rob.gardner@...cle.com, mingo@...nel.org, nitin.m.gupta@...cle.com,
anthony.yznaga@...cle.com, kirill.shutemov@...ux.intel.com,
tom.hromatka@...cle.com, allen.pais@...cle.com,
tklauser@...tanz.ch, shannon.nelson@...cle.com,
vijay.ac.kumar@...cle.com, mhocko@...e.com, jack@...e.cz,
punit.agrawal@....com, hughd@...gle.com, thomas.tai@...cle.com,
ross.zwisler@...ux.intel.com, dave.jiang@...el.com,
willy@...radead.org, minchan@...nel.org,
imbrenda@...ux.vnet.ibm.com, aarcange@...hat.com,
kstewart@...uxfoundation.org, pombredanne@...b.com,
tglx@...utronix.de, gregkh@...uxfoundation.org,
nagarathnam.muthusamy@...cle.com, linux@...ck-us.net,
jane.chu@...cle.com, dan.j.williams@...el.com, jglisse@...hat.com,
ktkhai@...tuozzo.com, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
sparclinux@...r.kernel.org, Khalid Aziz <khalid@...ehiking.org>
Subject: Re: [PATCH v12 10/11] sparc64: Add support for ADI (Application Data
Integrity)
On 03/05/2018 01:37 PM, Khalid Aziz wrote:
>> How big can this storage get, btw? Superficially it seems like it might
>> be able to be gigantic for a large, sparse VMA.
>>
> Tags are stored only for the pages being swapped out, not for the pages
> in entire vma. Each tag storage page can hold tags for 128 pages (each
> page has 128 4-bit tags, hence 64 bytes are needed to store tags for an
> entire page allowing each page to store tags for 128 pages). Sparse VMA
> does not cause any problems since holes do not have corresponding pages
> that will be swapped out. Tag storage pages are freed once all the pages
> they store tags for have been swapped back in, except for a small number
> of pages (maximum of 8) marked for emergency tag storage.
With a linear scan holding a process-wide spinlock? If you have a fast
swap device, does this become the bottleneck when swapping ADI-tagged
memory?
FWIW, this tag storage is complex and subtle enough code that it
deserves to be in its own well-documented patch, not buried in a
thousand-line patch.
> +tag_storage_desc_t *find_tag_store(struct mm_struct *mm,
> + struct vm_area_struct *vma,
> + unsigned long addr)
> +{
> + tag_storage_desc_t *tag_desc = NULL;
> + unsigned long i, max_desc, flags;
> +
> + /* Check if this vma already has tag storage descriptor
> + * allocated for it.
> + */
> + max_desc = PAGE_SIZE/sizeof(tag_storage_desc_t);
> + if (mm->context.tag_store) {
> + tag_desc = mm->context.tag_store;
> + spin_lock_irqsave(&mm->context.tag_lock, flags);
> + for (i = 0; i < max_desc; i++) {
> + if ((addr >= tag_desc->start) &&
> + ((addr + PAGE_SIZE - 1) <= tag_desc->end))
> + break;
> + tag_desc++;
> + }
> + spin_unlock_irqrestore(&mm->context.tag_lock, flags);
Powered by blists - more mailing lists