The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* Re: [PATCH 1/2] mm/memory_failure: use bool for hugetlb indicator in try_memory_failure_hugetlb
       [not found]   ` <0eb4a198-e80b-127d-e729-3af6f63f6d5b@huawei.com>
@ 2026-05-06  3:22     ` Ye Liu
  0 siblings, 0 replies; 3+ messages in thread
From: Ye Liu @ 2026-05-06  3:22 UTC (permalink / raw)
  To: Miaohe Lin, Andrew Morton; +Cc: Ye Liu, Naoya Horiguchi, linux-mm, linux-kernel


Friendly ping.

在 2026/4/10 14:38, Miaohe Lin 写道:
> On 2026/4/7 10:07, Ye Liu wrote:
>> From: Ye Liu <liuye@kylinos.cn>
>>
>> The hugetlb indicator in try_memory_failure_hugetlb is a Boolean
>> flag, but was declared and assigned as int/0/1. Convert to `bool`
>> and `true`/`false` for clarity and type safety.
>>
>> - try_memory_failure_hugetlb(unsigned long pfn, int flags, bool *hugetlb)
>> - testcase path in memory_failure(): bool hugetlb = false
>> - clear semantic conversion in MF_HUGETLB_NON_HUGEPAGE
>> - preserve behavior (no functional change)
>>
>> Signed-off-by: Ye Liu <liuye@kylinos.cn>
> 
> Acked-by: Miaohe Lin <linmiaohe@huawei.com>
> 
> Thanks.
> .

-- 
Thanks,
Ye Liu


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] mm/memory-failure: use bool for forcekill state
       [not found]   ` <9d022499-2a77-f8c6-b86d-d9de838fac32@huawei.com>
@ 2026-05-09  0:08     ` Andrew Morton
  2026-05-09  2:28       ` Miaohe Lin
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2026-05-09  0:08 UTC (permalink / raw)
  To: Miaohe Lin; +Cc: Ye Liu, Ye Liu, Naoya Horiguchi, linux-mm, linux-kernel

On Fri, 10 Apr 2026 14:45:47 +0800 Miaohe Lin <linmiaohe@huawei.com> wrote:

> On 2026/4/7 10:07, Ye Liu wrote:
> > From: Ye Liu <liuye@kylinos.cn>
> > 
> > 'forcekill' is used as a boolean flag to control whether
> > processes should be forcibly killed. It is only assigned
> > from boolean expressions and never used in arithmetic or
> > bitmask operations.
> > 
> > Convert it from int to bool.
> > 
> > No functional change intended.
> > 
> > Signed-off-by: Ye Liu <liuye@kylinos.cn>
> > ---
> >  mm/memory-failure.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> > index d25adb390c3e..f355642bc2b6 100644
> > --- a/mm/memory-failure.c
> > +++ b/mm/memory-failure.c
> > @@ -459,7 +459,7 @@ void add_to_kill_ksm(struct task_struct *tsk, const struct page *p,
> >   * Only do anything when FORCEKILL is set, otherwise just free the
> >   * list (this is used for clean pages which do not need killing)
> >   */
> > -static void kill_procs(struct list_head *to_kill, int forcekill,
> > +static void kill_procs(struct list_head *to_kill, bool forcekill,
> >  		unsigned long pfn, int flags)
> >  {
> >  	struct to_kill *tk, *next;
> > @@ -1582,7 +1582,7 @@ static bool hwpoison_user_mappings(struct folio *folio, struct page *p,
> >  {
> >  	LIST_HEAD(tokill);
> >  	bool unmap_success;
> > -	int forcekill;
> > +	bool forcekill;
> >  	bool mlocked = folio_test_mlocked(folio);
> 
> There is one caller in unmap_and_kill():
> 	kill_procs(to_kill, flags & MF_MUST_KILL, pfn, flags);
> 
> It seems flags & MF_MUST_KILL does not return bool. So maybe we should change it
> to clear semantic conversion?

AI review was wondering the same thing ;) And possibly a changelog
glitch.

	https://sashiko.dev/#/patchset/20260407020715.2269255-2-ye.liu@linux.dev

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] mm/memory-failure: use bool for forcekill state
  2026-05-09  0:08     ` [PATCH 2/2] mm/memory-failure: use bool for forcekill state Andrew Morton
@ 2026-05-09  2:28       ` Miaohe Lin
  0 siblings, 0 replies; 3+ messages in thread
From: Miaohe Lin @ 2026-05-09  2:28 UTC (permalink / raw)
  To: Andrew Morton, Ye Liu; +Cc: Ye Liu, Naoya Horiguchi, linux-mm, linux-kernel

On 2026/5/9 8:08, Andrew Morton wrote:
> On Fri, 10 Apr 2026 14:45:47 +0800 Miaohe Lin <linmiaohe@huawei.com> wrote:
> 
>> On 2026/4/7 10:07, Ye Liu wrote:
>>> From: Ye Liu <liuye@kylinos.cn>
>>>
>>> 'forcekill' is used as a boolean flag to control whether
>>> processes should be forcibly killed. It is only assigned
>>> from boolean expressions and never used in arithmetic or
>>> bitmask operations.
>>>
>>> Convert it from int to bool.
>>>
>>> No functional change intended.
>>>
>>> Signed-off-by: Ye Liu <liuye@kylinos.cn>
>>> ---
>>>  mm/memory-failure.c | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
>>> index d25adb390c3e..f355642bc2b6 100644
>>> --- a/mm/memory-failure.c
>>> +++ b/mm/memory-failure.c
>>> @@ -459,7 +459,7 @@ void add_to_kill_ksm(struct task_struct *tsk, const struct page *p,
>>>   * Only do anything when FORCEKILL is set, otherwise just free the
>>>   * list (this is used for clean pages which do not need killing)
>>>   */
>>> -static void kill_procs(struct list_head *to_kill, int forcekill,
>>> +static void kill_procs(struct list_head *to_kill, bool forcekill,
>>>  		unsigned long pfn, int flags)
>>>  {
>>>  	struct to_kill *tk, *next;
>>> @@ -1582,7 +1582,7 @@ static bool hwpoison_user_mappings(struct folio *folio, struct page *p,
>>>  {
>>>  	LIST_HEAD(tokill);
>>>  	bool unmap_success;
>>> -	int forcekill;
>>> +	bool forcekill;
>>>  	bool mlocked = folio_test_mlocked(folio);
>>
>> There is one caller in unmap_and_kill():
>> 	kill_procs(to_kill, flags & MF_MUST_KILL, pfn, flags);
>>
>> It seems flags & MF_MUST_KILL does not return bool. So maybe we should change it
>> to clear semantic conversion?
> 
> AI review was wondering the same thing ;) And possibly a changelog
> glitch.
> 
> 	https://sashiko.dev/#/patchset/20260407020715.2269255-2-ye.liu@linux.dev

Thanks Andrew. I see there is a v2 patch [1] that has used a boolean expression to
align with the commit's stated intent as AI requested. I guess you might missed that
thread.

[1] https://lore.kernel.org/all/20260410074740.2524718-1-ye.liu@linux.dev/

Thanks.
.

> 
> .
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-09  2:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20260407020715.2269255-1-ye.liu@linux.dev>
     [not found] ` <20260407020715.2269255-2-ye.liu@linux.dev>
     [not found]   ` <0eb4a198-e80b-127d-e729-3af6f63f6d5b@huawei.com>
2026-05-06  3:22     ` [PATCH 1/2] mm/memory_failure: use bool for hugetlb indicator in try_memory_failure_hugetlb Ye Liu
     [not found] ` <20260407020715.2269255-3-ye.liu@linux.dev>
     [not found]   ` <9d022499-2a77-f8c6-b86d-d9de838fac32@huawei.com>
2026-05-09  0:08     ` [PATCH 2/2] mm/memory-failure: use bool for forcekill state Andrew Morton
2026-05-09  2:28       ` Miaohe Lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox