All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm: dovetail: rename page_needs_cow_for_dma() to page_needs_cow()
@ 2022-01-09 18:13 Philippe Gerum
  2022-01-09 18:15 ` Philippe Gerum
  0 siblings, 1 reply; 4+ messages in thread
From: Philippe Gerum @ 2022-01-09 18:13 UTC (permalink / raw)
  To: xenomai

From: Philippe Gerum <rpm@xenomai.org>

With the addition of the Dovetail COW-breaking logic,
page_needs_cow_for_dma() does not exclusively apply to pinned memory
for DMA anymore. Give it a more generic name.

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 include/linux/mm.h | 4 ++--
 mm/huge_memory.c   | 4 ++--
 mm/hugetlb.c       | 2 +-
 mm/memory.c        | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index db6bb27a008ce8f..d3a51989ad89f93 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1340,8 +1340,8 @@ static inline bool is_cow_mapping(vm_flags_t flags)
  * This should most likely only be called during fork() to see whether we
  * should break the cow immediately for a page on the src mm.
  */
-static inline bool page_needs_cow_for_dma(struct vm_area_struct *vma,
-					  struct page *page)
+static inline bool page_needs_cow(struct vm_area_struct *vma,
+				struct page *page)
 {
 	if (!is_cow_mapping(vma->vm_flags))
 		return false;
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index c5142d237e482fe..c7bba75945e97c9 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -1104,7 +1104,7 @@ int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm,
 	 * best effort that the pinned pages won't be replaced by another
 	 * random page during the coming copy-on-write.
 	 */
-	if (unlikely(page_needs_cow_for_dma(src_vma, src_page))) {
+	if (unlikely(page_needs_cow(src_vma, src_page))) {
 		pte_free(dst_mm, pgtable);
 		spin_unlock(src_ptl);
 		spin_unlock(dst_ptl);
@@ -1218,7 +1218,7 @@ int copy_huge_pud(struct mm_struct *dst_mm, struct mm_struct *src_mm,
 	}
 
 	/* Please refer to comments in copy_huge_pmd() */
-	if (unlikely(page_needs_cow_for_dma(vma, pud_page(pud)))) {
+	if (unlikely(page_needs_cow(vma, pud_page(pud)))) {
 		spin_unlock(src_ptl);
 		spin_unlock(dst_ptl);
 		__split_huge_pud(vma, src_pud, addr);
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index f5ed98843557b74..c8fc2462a7faf02 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -4363,7 +4363,7 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src,
 			 * need to be without the pgtable locks since we could
 			 * sleep during the process.
 			 */
-			if (unlikely(page_needs_cow_for_dma(vma, ptepage))) {
+			if (unlikely(page_needs_cow(vma, ptepage))) {
 				pte_t src_pte_old = entry;
 				struct page *new;
 
diff --git a/mm/memory.c b/mm/memory.c
index c0d89177e2c359d..c1721f751d542b5 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -900,7 +900,7 @@ copy_present_page(struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma
 	 * the page count. That might give false positives for
 	 * for pinning, but it will work correctly.
 	 */
-	if (likely(!page_needs_cow_for_dma(src_vma, page)))
+	if (likely(!page_needs_cow(src_vma, page)))
 		return 1;
 
 	new_page = *prealloc;
-- 
2.31.1



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

* Re: [PATCH] mm: dovetail: rename page_needs_cow_for_dma() to page_needs_cow()
  2022-01-09 18:13 [PATCH] mm: dovetail: rename page_needs_cow_for_dma() to page_needs_cow() Philippe Gerum
@ 2022-01-09 18:15 ` Philippe Gerum
  2022-01-10  6:16   ` Jan Kiszka
  0 siblings, 1 reply; 4+ messages in thread
From: Philippe Gerum @ 2022-01-09 18:15 UTC (permalink / raw)
  To: xenomai


Philippe  Gerum <rpm@xenomai.org> writes:

> From: Philippe Gerum <rpm@xenomai.org>
>
> With the addition of the Dovetail COW-breaking logic,
> page_needs_cow_for_dma() does not exclusively apply to pinned memory
> for DMA anymore. Give it a more generic name.
>

Should that be merged to the v4 fix?

-- 
Philippe.


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

* Re: [PATCH] mm: dovetail: rename page_needs_cow_for_dma() to page_needs_cow()
  2022-01-09 18:15 ` Philippe Gerum
@ 2022-01-10  6:16   ` Jan Kiszka
  2022-01-10  7:56     ` Philippe Gerum
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Kiszka @ 2022-01-10  6:16 UTC (permalink / raw)
  To: Philippe Gerum, xenomai

On 09.01.22 19:15, Philippe Gerum via Xenomai wrote:
> 
> Philippe  Gerum <rpm@xenomai.org> writes:
> 
>> From: Philippe Gerum <rpm@xenomai.org>
>>
>> With the addition of the Dovetail COW-breaking logic,
>> page_needs_cow_for_dma() does not exclusively apply to pinned memory
>> for DMA anymore. Give it a more generic name.
>>
> 
> Should that be merged to the v4 fix?
> 

Yeah, would be more consistent.

Will you push that patch to the rebase branch soon? Asking because CI
would then pick it up from there automatically.

Jan

-- 
Siemens AG, Technology
Competence Center Embedded Linux


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

* Re: [PATCH] mm: dovetail: rename page_needs_cow_for_dma() to page_needs_cow()
  2022-01-10  6:16   ` Jan Kiszka
@ 2022-01-10  7:56     ` Philippe Gerum
  0 siblings, 0 replies; 4+ messages in thread
From: Philippe Gerum @ 2022-01-10  7:56 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai


Jan Kiszka <jan.kiszka@siemens.com> writes:

> On 09.01.22 19:15, Philippe Gerum via Xenomai wrote:
>> 
>> Philippe  Gerum <rpm@xenomai.org> writes:
>> 
>>> From: Philippe Gerum <rpm@xenomai.org>
>>>
>>> With the addition of the Dovetail COW-breaking logic,
>>> page_needs_cow_for_dma() does not exclusively apply to pinned memory
>>> for DMA anymore. Give it a more generic name.
>>>
>> 
>> Should that be merged to the v4 fix?
>> 
>
> Yeah, would be more consistent.
>
> Will you push that patch to the rebase branch soon? Asking because CI
> would then pick it up from there automatically.
>

This patch is now merged into the -rebase branch. I sent it as v5 to the
list as well for further reference.

-- 
Philippe.


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

end of thread, other threads:[~2022-01-10  7:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-09 18:13 [PATCH] mm: dovetail: rename page_needs_cow_for_dma() to page_needs_cow() Philippe Gerum
2022-01-09 18:15 ` Philippe Gerum
2022-01-10  6:16   ` Jan Kiszka
2022-01-10  7:56     ` Philippe Gerum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.