[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <add77995-2e39-4f8c-b827-766fa8631ae2@web.de>
Date: Thu, 16 Oct 2025 16:37:55 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: Longlong Xia <xialonglong@...inos.cn>, linux-mm@...ck.org,
David Hildenbrand <david@...hat.com>, Lance Yang <lance.yang@...ux.dev>,
Miaohe Lin <linmiaohe@...wei.com>, Naoya Horiguchi <nao.horiguchi@...il.com>
Cc: Longlong Xia <xialonglong2025@....com>,
LKML <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Kefeng Wang <wangkefeng.wang@...wei.com>, Qiuxu Zhuo <qiuxu.zhuo@...el.com>,
xu xin <xu.xin16@....com.cn>
Subject: Re: [PATCH v2] mm/ksm: recover from memory failure on KSM page by
migrating to healthy duplicate
…> This patch introduces …
See also once more:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.17#n94
…> +++ b/mm/ksm.c
…
> +static int replace_failing_page(struct vm_area_struct *vma, struct page *page,
> + struct page *kpage, unsigned long addr)
> +{
…> + int err = -EFAULT;
…> + pmd = mm_find_pmd(mm, addr);
> + if (!pmd)
> + goto out;
Please return directly here.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v6.17#n532
…> +out_mn:
> + mmu_notifier_invalidate_range_end(&range);
> +out:
> + return err;
> +}
> +
> +static void migrate_to_target_dup(struct ksm_stable_node *failing_node,
> + struct folio *failing_folio,
> + struct folio *target_folio,
> + struct ksm_stable_node *target_dup)
> +{
…> + hlist_for_each_entry_safe(rmap_item, hlist_safe, &failing_node->hlist, hlist) {
> + struct mm_struct *mm = rmap_item->mm;
> + unsigned long addr = rmap_item->address & PAGE_MASK;
> + struct vm_area_struct *vma;
> +
> + if (!mmap_read_trylock(mm))
> + continue;
> +
> + if (ksm_test_exit(mm)) {
> + mmap_read_unlock(mm);
> + continue;
> + }
I suggest to avoid duplicate source code here by using another label.
Will such an implementation details become relevant for the application of scope-based resource management?
https://elixir.bootlin.com/linux/v6.17.1/source/include/linux/mmap_lock.h#L483-L484
…> + folio_unlock(target_folio);
+unlock:> + mmap_read_unlock(mm);
> + }
> +
> +}
> +
> +static bool ksm_recover_within_chain(struct ksm_stable_node *failing_node)
> +{
…> + if (new_page && new_stable_node) {
> + migrate_to_target_dup(failing_node, failing_folio,
> + page_folio(new_page), new_stable_node);
> + } else {
> + migrate_to_target_dup(failing_node, failing_folio,
> + healthy_folio, healthy_dupdup);
> + }
…
How do you think about to omit curly brackets?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v6.17#n197
Regards,
Markus
Powered by blists - more mailing lists