* [QUESTION] mm: Redundant const parameter?
@ 2024-05-31 11:12 Dev Jain
2024-05-31 11:31 ` Dev Jain
2024-05-31 12:17 ` Matthew Wilcox
0 siblings, 2 replies; 7+ messages in thread
From: Dev Jain @ 2024-05-31 11:12 UTC (permalink / raw)
To: zhouchengming; +Cc: linux-mm, linux-kernel, Anshuman.Khandual
Hi Chengming,
In mm/slub.c, you had defined slab_test_node_partial() to take a const
parameter.
Is there any point of taking in a const, when you are anyways
typecasting it to
a (struct folio *) from (const struct folio *) ? In fact, at the place
where you call
slab_test_node_partial(), the struct slab *slab is not const.
Please comment.
Thanks
DJ
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [QUESTION] mm: Redundant const parameter?
2024-05-31 11:12 [QUESTION] mm: Redundant const parameter? Dev Jain
@ 2024-05-31 11:31 ` Dev Jain
2024-05-31 12:30 ` [External] " Chengming Zhou
2024-05-31 12:17 ` Matthew Wilcox
1 sibling, 1 reply; 7+ messages in thread
From: Dev Jain @ 2024-05-31 11:31 UTC (permalink / raw)
To: zhouchengming; +Cc: linux-mm, linux-kernel, Anshuman.Khandual
I guess it would be better if I send this as a patch and wait for comments.
On 5/31/24 16:42, Dev Jain wrote:
> Hi Chengming,
>
> In mm/slub.c, you had defined slab_test_node_partial() to take a const
> parameter.
>
> Is there any point of taking in a const, when you are anyways
> typecasting it to
>
> a (struct folio *) from (const struct folio *) ? In fact, at the place
> where you call
>
> slab_test_node_partial(), the struct slab *slab is not const.
>
> Please comment.
>
>
> Thanks
>
> DJ
>
>
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [External] Re: [QUESTION] mm: Redundant const parameter?
2024-05-31 11:31 ` Dev Jain
@ 2024-05-31 12:30 ` Chengming Zhou
2024-05-31 12:38 ` Dev Jain
2024-05-31 13:20 ` Matthew Wilcox
0 siblings, 2 replies; 7+ messages in thread
From: Chengming Zhou @ 2024-05-31 12:30 UTC (permalink / raw)
To: Dev Jain; +Cc: linux-mm, linux-kernel, Anshuman.Khandual
On 2024/5/31 19:31, Dev Jain wrote:
> I guess it would be better if I send this as a patch and wait for comments.
Ah, you're right. I think it should be:
return folio_test_workingset(slab_folio(slab));
Right? Don't notice there isn't any build warning about this "const" discard.
Thanks.
>
> On 5/31/24 16:42, Dev Jain wrote:
>> Hi Chengming,
>>
>> In mm/slub.c, you had defined slab_test_node_partial() to take a const parameter.
>>
>> Is there any point of taking in a const, when you are anyways typecasting it to
>>
>> a (struct folio *) from (const struct folio *) ? In fact, at the place where you call
>>
>> slab_test_node_partial(), the struct slab *slab is not const.
>>
>> Please comment.
>>
>>
>> Thanks
>>
>> DJ
>>
>>
>>
>>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [External] Re: [QUESTION] mm: Redundant const parameter?
2024-05-31 12:30 ` [External] " Chengming Zhou
@ 2024-05-31 12:38 ` Dev Jain
2024-05-31 13:20 ` Matthew Wilcox
1 sibling, 0 replies; 7+ messages in thread
From: Dev Jain @ 2024-05-31 12:38 UTC (permalink / raw)
To: Chengming Zhou; +Cc: linux-mm, linux-kernel, Anshuman.Khandual
Yes; Matthew just did a wider fix:
https://lore.kernel.org/all/20240531122904.2790052-1-willy@infradead.org/
On 5/31/24 18:00, Chengming Zhou wrote:
> On 2024/5/31 19:31, Dev Jain wrote:
>> I guess it would be better if I send this as a patch and wait for comments.
> Ah, you're right. I think it should be:
>
> return folio_test_workingset(slab_folio(slab));
>
> Right? Don't notice there isn't any build warning about this "const" discard.
>
> Thanks.
>
>> On 5/31/24 16:42, Dev Jain wrote:
>>> Hi Chengming,
>>>
>>> In mm/slub.c, you had defined slab_test_node_partial() to take a const parameter.
>>>
>>> Is there any point of taking in a const, when you are anyways typecasting it to
>>>
>>> a (struct folio *) from (const struct folio *) ? In fact, at the place where you call
>>>
>>> slab_test_node_partial(), the struct slab *slab is not const.
>>>
>>> Please comment.
>>>
>>>
>>> Thanks
>>>
>>> DJ
>>>
>>>
>>>
>>>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [External] Re: [QUESTION] mm: Redundant const parameter?
2024-05-31 12:30 ` [External] " Chengming Zhou
2024-05-31 12:38 ` Dev Jain
@ 2024-05-31 13:20 ` Matthew Wilcox
1 sibling, 0 replies; 7+ messages in thread
From: Matthew Wilcox @ 2024-05-31 13:20 UTC (permalink / raw)
To: Chengming Zhou; +Cc: Dev Jain, linux-mm, linux-kernel, Anshuman.Khandual
On Fri, May 31, 2024 at 08:30:08PM +0800, Chengming Zhou wrote:
> On 2024/5/31 19:31, Dev Jain wrote:
> > I guess it would be better if I send this as a patch and wait for comments.
>
> Ah, you're right. I think it should be:
>
> return folio_test_workingset(slab_folio(slab));
>
> Right? Don't notice there isn't any build warning about this "const" discard.
But there used to be! I fixed that in ce3467af6bde dated Feb 27 2024,
which took a fair amount of prep work to make happen.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [QUESTION] mm: Redundant const parameter?
2024-05-31 11:12 [QUESTION] mm: Redundant const parameter? Dev Jain
2024-05-31 11:31 ` Dev Jain
@ 2024-05-31 12:17 ` Matthew Wilcox
2024-05-31 12:24 ` Dev Jain
1 sibling, 1 reply; 7+ messages in thread
From: Matthew Wilcox @ 2024-05-31 12:17 UTC (permalink / raw)
To: Dev Jain; +Cc: zhouchengming, linux-mm, linux-kernel, Anshuman.Khandual
On Fri, May 31, 2024 at 04:42:59PM +0530, Dev Jain wrote:
> Hi Chengming,
>
> In mm/slub.c, you had defined slab_test_node_partial() to take a const
> parameter.
>
> Is there any point of taking in a const, when you are anyways typecasting it
> to
>
> a (struct folio *) from (const struct folio *) ? In fact, at the place where
> you call
>
> slab_test_node_partial(), the struct slab *slab is not const.
I have a patch to fix this; hang on a second ...
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [QUESTION] mm: Redundant const parameter?
2024-05-31 12:17 ` Matthew Wilcox
@ 2024-05-31 12:24 ` Dev Jain
0 siblings, 0 replies; 7+ messages in thread
From: Dev Jain @ 2024-05-31 12:24 UTC (permalink / raw)
To: Matthew Wilcox; +Cc: zhouchengming, linux-mm, linux-kernel, Anshuman.Khandual
I was just about to hit git send-email for a patch-series of 2, I
noticed your reply :)
On 5/31/24 17:47, Matthew Wilcox wrote:
> On Fri, May 31, 2024 at 04:42:59PM +0530, Dev Jain wrote:
>> Hi Chengming,
>>
>> In mm/slub.c, you had defined slab_test_node_partial() to take a const
>> parameter.
>>
>> Is there any point of taking in a const, when you are anyways typecasting it
>> to
>>
>> a (struct folio *) from (const struct folio *) ? In fact, at the place where
>> you call
>>
>> slab_test_node_partial(), the struct slab *slab is not const.
> I have a patch to fix this; hang on a second ...
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-05-31 13:21 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-31 11:12 [QUESTION] mm: Redundant const parameter? Dev Jain
2024-05-31 11:31 ` Dev Jain
2024-05-31 12:30 ` [External] " Chengming Zhou
2024-05-31 12:38 ` Dev Jain
2024-05-31 13:20 ` Matthew Wilcox
2024-05-31 12:17 ` Matthew Wilcox
2024-05-31 12:24 ` Dev Jain
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox