diff mbox series

[2/3] mm: pgtable: add missing pt_index to struct ptdesc

Message ID 283624c2af45fb2090b41a6b1b5481bb0a45bad7.1709541697.git.zhengqi.arch@bytedance.com (mailing list archive)
State New
Headers show
Series minor fixes and supplement for ptdesc | expand

Commit Message

Qi Zheng March 4, 2024, 11:07 a.m. UTC
In s390, the page->index field is used for gmap (see gmap_shadow_pgt()),
so add the corresponding pt_index to struct ptdesc and add a comment to
clarify this.

Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
---
 include/linux/mm_types.h | 3 +++
 1 file changed, 3 insertions(+)

Comments

Vishal Moola March 26, 2024, 7:25 p.m. UTC | #1
On Mon, Mar 04, 2024 at 07:07:19PM +0800, Qi Zheng wrote:
> In s390, the page->index field is used for gmap (see gmap_shadow_pgt()),
> so add the corresponding pt_index to struct ptdesc and add a comment to
> clarify this.

Yes s390 gmap 'uses' page->index, but not for the purpose page->index is
supposed to hold. It's alright to have a variable here, but I'd rather
see it named something more appropriate to the purporse it serves.

You can take look at this patch from v5 of my ptdesc conversion series
for more info:
https://lore.kernel.org/linux-mm/20230622205745.79707-3-vishal.moola@gmail.com/

> Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
> ---
>  include/linux/mm_types.h | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
> index 5ea77969daae..5240bd7bca33 100644
> --- a/include/linux/mm_types.h
> +++ b/include/linux/mm_types.h
> @@ -425,6 +425,7 @@ FOLIO_MATCH(compound_head, _head_2a);
>   * @_pt_pad_1:        Padding that aliases with page's compound head.
>   * @pmd_huge_pte:     Protected by ptdesc->ptl, used for THPs.
>   * @__page_mapping:   Aliases with page->mapping. Unused for page tables.
> + * @pt_index:         Used for s390 gmap.
>   * @pt_mm:            Used for x86 pgds.
>   * @pt_frag_refcount: For fragmented page table tracking. Powerpc only.
>   * @_pt_pad_2:        Padding to ensure proper alignment.
> @@ -450,6 +451,7 @@ struct ptdesc {
>  	unsigned long __page_mapping;
>  
>  	union {
> +		pgoff_t pt_index;
>  		struct mm_struct *pt_mm;
>  		atomic_t pt_frag_refcount;
>  	};
> @@ -475,6 +477,7 @@ TABLE_MATCH(flags, __page_flags);
>  TABLE_MATCH(compound_head, pt_list);
>  TABLE_MATCH(compound_head, _pt_pad_1);
>  TABLE_MATCH(mapping, __page_mapping);
> +TABLE_MATCH(index, pt_index);
>  TABLE_MATCH(rcu_head, pt_rcu_head);
>  TABLE_MATCH(page_type, __page_type);
>  TABLE_MATCH(_refcount, __page_refcount);
> -- 
> 2.30.2
>
Qi Zheng March 27, 2024, 2:06 a.m. UTC | #2
On 2024/3/27 03:25, Vishal Moola wrote:
> On Mon, Mar 04, 2024 at 07:07:19PM +0800, Qi Zheng wrote:
>> In s390, the page->index field is used for gmap (see gmap_shadow_pgt()),
>> so add the corresponding pt_index to struct ptdesc and add a comment to
>> clarify this.
> 
> Yes s390 gmap 'uses' page->index, but not for the purpose page->index is
> supposed to hold. It's alright to have a variable here, but I'd rather
> see it named something more appropriate to the purporse it serves.

Make sense.

> 
> You can take look at this patch from v5 of my ptdesc conversion series
> for more info:
> https://lore.kernel.org/linux-mm/20230622205745.79707-3-vishal.moola@gmail.com/

Oh, but it seems that this patch has not been merged?

> 
>> Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
>> ---
>>   include/linux/mm_types.h | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
>> index 5ea77969daae..5240bd7bca33 100644
>> --- a/include/linux/mm_types.h
>> +++ b/include/linux/mm_types.h
>> @@ -425,6 +425,7 @@ FOLIO_MATCH(compound_head, _head_2a);
>>    * @_pt_pad_1:        Padding that aliases with page's compound head.
>>    * @pmd_huge_pte:     Protected by ptdesc->ptl, used for THPs.
>>    * @__page_mapping:   Aliases with page->mapping. Unused for page tables.
>> + * @pt_index:         Used for s390 gmap.
>>    * @pt_mm:            Used for x86 pgds.
>>    * @pt_frag_refcount: For fragmented page table tracking. Powerpc only.
>>    * @_pt_pad_2:        Padding to ensure proper alignment.
>> @@ -450,6 +451,7 @@ struct ptdesc {
>>   	unsigned long __page_mapping;
>>   
>>   	union {
>> +		pgoff_t pt_index;
>>   		struct mm_struct *pt_mm;
>>   		atomic_t pt_frag_refcount;
>>   	};
>> @@ -475,6 +477,7 @@ TABLE_MATCH(flags, __page_flags);
>>   TABLE_MATCH(compound_head, pt_list);
>>   TABLE_MATCH(compound_head, _pt_pad_1);
>>   TABLE_MATCH(mapping, __page_mapping);
>> +TABLE_MATCH(index, pt_index);
>>   TABLE_MATCH(rcu_head, pt_rcu_head);
>>   TABLE_MATCH(page_type, __page_type);
>>   TABLE_MATCH(_refcount, __page_refcount);
>> -- 
>> 2.30.2
>>
diff mbox series

Patch

diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 5ea77969daae..5240bd7bca33 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -425,6 +425,7 @@  FOLIO_MATCH(compound_head, _head_2a);
  * @_pt_pad_1:        Padding that aliases with page's compound head.
  * @pmd_huge_pte:     Protected by ptdesc->ptl, used for THPs.
  * @__page_mapping:   Aliases with page->mapping. Unused for page tables.
+ * @pt_index:         Used for s390 gmap.
  * @pt_mm:            Used for x86 pgds.
  * @pt_frag_refcount: For fragmented page table tracking. Powerpc only.
  * @_pt_pad_2:        Padding to ensure proper alignment.
@@ -450,6 +451,7 @@  struct ptdesc {
 	unsigned long __page_mapping;
 
 	union {
+		pgoff_t pt_index;
 		struct mm_struct *pt_mm;
 		atomic_t pt_frag_refcount;
 	};
@@ -475,6 +477,7 @@  TABLE_MATCH(flags, __page_flags);
 TABLE_MATCH(compound_head, pt_list);
 TABLE_MATCH(compound_head, _pt_pad_1);
 TABLE_MATCH(mapping, __page_mapping);
+TABLE_MATCH(index, pt_index);
 TABLE_MATCH(rcu_head, pt_rcu_head);
 TABLE_MATCH(page_type, __page_type);
 TABLE_MATCH(_refcount, __page_refcount);