[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250901135408.5965-1-roypat@amazon.co.uk>
Date: Mon, 1 Sep 2025 13:54:10 +0000
From: "Roy, Patrick" <roypat@...zon.co.uk>
To: "tabba@...gle.com" <tabba@...gle.com>
CC: "ackerleytng@...gle.com" <ackerleytng@...gle.com>, "david@...hat.com"
<david@...hat.com>, "Manwaring, Derek" <derekmn@...zon.com>, "Thomson, Jack"
<jackabt@...zon.co.uk>, "Kalyazin, Nikita" <kalyazin@...zon.co.uk>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>, "kvmarm@...ts.linux.dev"
<kvmarm@...ts.linux.dev>, "linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "linux-mm@...ck.org" <linux-mm@...ck.org>,
"pbonzini@...hat.com" <pbonzini@...hat.com>, "Roy, Patrick"
<roypat@...zon.co.uk>, "rppt@...nel.org" <rppt@...nel.org>,
"seanjc@...gle.com" <seanjc@...gle.com>, "vbabka@...e.cz" <vbabka@...e.cz>,
"will@...nel.org" <will@...nel.org>, "Cali, Marco" <xmarcalx@...zon.co.uk>
Subject: Re: [PATCH v5 03/12] mm: introduce AS_NO_DIRECT_MAP
Hi Fuad!
On Thu, 2025-08-28 at 11:21 +0100, Fuad Tabba wrote:
> Hi Patrick,
>
> On Thu, 28 Aug 2025 at 10:39, Roy, Patrick <roypat@...zon.co.uk> wrote:
>> diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
>> index 12a12dae727d..b52b28ae4636 100644
>> --- a/include/linux/pagemap.h
>> +++ b/include/linux/pagemap.h
>> @@ -211,6 +211,7 @@ enum mapping_flags {
>> folio contents */
>> AS_INACCESSIBLE = 8, /* Do not attempt direct R/W access to the mapping */
>> AS_WRITEBACK_MAY_DEADLOCK_ON_RECLAIM = 9,
>> + AS_NO_DIRECT_MAP = 10, /* Folios in the mapping are not in the direct map */
>> /* Bits 16-25 are used for FOLIO_ORDER */
>> AS_FOLIO_ORDER_BITS = 5,
>> AS_FOLIO_ORDER_MIN = 16,
>> @@ -346,6 +347,21 @@ static inline bool mapping_writeback_may_deadlock_on_reclaim(struct address_spac
>> return test_bit(AS_WRITEBACK_MAY_DEADLOCK_ON_RECLAIM, &mapping->flags);
>> }
>>
>> +static inline void mapping_set_no_direct_map(struct address_space *mapping)
>> +{
>> + set_bit(AS_NO_DIRECT_MAP, &mapping->flags);
>> +}
>> +
>> +static inline bool mapping_no_direct_map(struct address_space *mapping)
>> +{
>> + return test_bit(AS_NO_DIRECT_MAP, &mapping->flags);
>> +}
>> +
>> +static inline bool vma_is_no_direct_map(const struct vm_area_struct *vma)
>> +{
>> + return vma->vm_file && mapping_no_direct_map(vma->vm_file->f_mapping);
>> +}
>> +
> Any reason vma is const whereas mapping in the function that it calls
> (defined above it) isn't?
Ah, I cannot say that that was a conscious decision, but rather an artifact of
the code that I looked at for reference when writing these two simply did it
this way. Are you saying both should be const, or neither (in my mind, both
could be const, but the mapping_*() family of functions further up in this file
dont take const arguments, so I'm a bit unsure now)?
> Cheers,
> /fuad
Best,
Patrick
Powered by blists - more mailing lists