linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Kefeng Wang <wangkefeng.wang@huawei.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Hugh Dickins <hughd@google.com>
Cc: Barry Song <baohua@kernel.org>,
	Ryan Roberts <ryan.roberts@arm.com>,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	Matthew Wilcox <willy@infradead.org>,
	linux-mm@kvack.org
Subject: Re: [PATCH v2] mm: shmem: remove __shmem_huge_global_enabled()
Date: Mon, 4 Nov 2024 21:53:58 +0100	[thread overview]
Message-ID: <5d02563e-86cb-43f5-b10d-a0f5aed4d946@redhat.com> (raw)
In-Reply-To: <713a2c5d-e6e8-471f-96a5-1f54fe2d35b8@huawei.com>

On 01.11.24 02:07, Kefeng Wang wrote:
> 
> 
> On 2024/10/30 21:09, David Hildenbrand wrote:
>> On 17.10.24 16:14, Kefeng Wang wrote:
>>> Remove __shmem_huge_global_enabled() since only one caller,
>>> and remove repeated check of VM_NOHUGEPAGE/MMF_DISABLE_THP
>>> as they are checked in shmem_allowable_huge_orders(), also
>>> remove unnecessary vma parameter.
>>>
>>> Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
>>> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
>>> ---
>>> v2:
>>> - Add RB and send separately
>>>
>>>    mm/shmem.c | 33 ++++++++++-----------------------
>>>    1 file changed, 10 insertions(+), 23 deletions(-)
>>>
>>> diff --git a/mm/shmem.c b/mm/shmem.c
>>> index 247c0403af83..e933327d8dac 100644
>>> --- a/mm/shmem.c
>>> +++ b/mm/shmem.c
>>> @@ -548,17 +548,15 @@ static bool shmem_confirm_swap(struct
>>> address_space *mapping,
>>>    static int shmem_huge __read_mostly = SHMEM_HUGE_NEVER;
>>> -static bool __shmem_huge_global_enabled(struct inode *inode, pgoff_t
>>> index,
>>> -                    loff_t write_end, bool shmem_huge_force,
>>> -                    struct vm_area_struct *vma,
>>> -                    unsigned long vm_flags)
>>> +static bool shmem_huge_global_enabled(struct inode *inode, pgoff_t
>>> index,
>>> +                      loff_t write_end, bool shmem_huge_force,
>>> +                      unsigned long vm_flags)
>>
>> Please use double tabs on the second+ parameter list.
> 
> Ok, I will send a tab fix patch.
> 
>>
>>>    {
>>> -    struct mm_struct *mm = vma ? vma->vm_mm : NULL;
>>>        loff_t i_size;
>>> -    if (!S_ISREG(inode->i_mode))
>>> +    if (HPAGE_PMD_ORDER > MAX_PAGECACHE_ORDER)
>>>            return false;
>>> -    if (mm && ((vm_flags & VM_NOHUGEPAGE) ||
>>> test_bit(MMF_DISABLE_THP, &mm->flags)))
>>
>> But where is this check for shmem_getattr()?
> 
> 
> In shmem_getattr(), the vma=NULL/vm_flags=0, so only vm_flags check is
> enough.
> 
> -	if (shmem_huge_global_enabled(inode, 0, 0, false, NULL, 0))
> +	if (shmem_huge_global_enabled(inode, 0, 0, false, 0))
> 

Ah, missed that, makes perfect sense!

Acked-by: David Hildenbrand <david@redhat.com>

-- 
Cheers,

David / dhildenb



      reply	other threads:[~2024-11-04 20:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-17 14:14 [PATCH v2] mm: huge_memory: move file_thp_enabled() into huge_memory.c Kefeng Wang
2024-10-17 14:14 ` [PATCH v2] mm: shmem: remove __shmem_huge_global_enabled() Kefeng Wang
2024-10-30 13:09   ` David Hildenbrand
2024-11-01  1:07     ` Kefeng Wang
2024-11-04 20:53       ` David Hildenbrand [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5d02563e-86cb-43f5-b10d-a0f5aed4d946@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=hughd@google.com \
    --cc=linux-mm@kvack.org \
    --cc=ryan.roberts@arm.com \
    --cc=wangkefeng.wang@huawei.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox