[PATCH v1 1/2] zsmalloc: zs_object_copy: add clarifying comment

Alexey Romanov posted 2 patches 3 years, 8 months ago
There is a newer version of this series
[PATCH v1 1/2] zsmalloc: zs_object_copy: add clarifying comment
Posted by Alexey Romanov 3 years, 8 months ago
It's not obvious why kunmap_atomic(d_addr) call is needed.

Signed-off-by: Alexey Romanov <avromanov@sberdevices.ru>
---
 mm/zsmalloc.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 5d5fc04385b8..5efa8c592193 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -1564,6 +1564,12 @@ static void zs_object_copy(struct size_class *class, unsigned long dst,
 		d_off += size;
 		d_size -= size;
 
+		/* Calling kunmap_atomic(d_addr) is necessary. kunmap_atomic() calls
+		 * must occurs in reverse order of calls to kmap_atomic().
+		 * So, to call kunmap_atomic(s_addr) we should first call kunmap_atomic(d_addr).
+		 * For more details see:
+		 * https://lore.kernel.org/linux-mm/5512421D.4000603@samsung.com/
+		 */
 		if (s_off >= PAGE_SIZE) {
 			kunmap_atomic(d_addr);
 			kunmap_atomic(s_addr);
-- 
2.30.1
Re: [PATCH v1 1/2] zsmalloc: zs_object_copy: add clarifying comment
Posted by Sergey Senozhatsky 3 years, 7 months ago
On (22/08/11 18:37), Alexey Romanov wrote:
> @@ -1564,6 +1564,12 @@ static void zs_object_copy(struct size_class *class, unsigned long dst,
>  		d_off += size;
>  		d_size -= size;
>  
> +		/* Calling kunmap_atomic(d_addr) is necessary. kunmap_atomic() calls
> +		 * must occurs in reverse order of calls to kmap_atomic().
> +		 * So, to call kunmap_atomic(s_addr) we should first call kunmap_atomic(d_addr).
> +		 * For more details see:
> +		 * https://lore.kernel.org/linux-mm/5512421D.4000603@samsung.com/
> +		 */

I'd drop the link part, Emails are not documentation, kmap_atomic
is documented in Documentation/mm/highmem
Re: [PATCH v1 1/2] zsmalloc: zs_object_copy: add clarifying comment
Posted by Aleksey Romanov 3 years, 7 months ago
Hi, Sergey.

On Mon, Aug 15, 2022 at 11:52:47AM +0900, Sergey Senozhatsky wrote:
> On (22/08/11 18:37), Alexey Romanov wrote:
> > @@ -1564,6 +1564,12 @@ static void zs_object_copy(struct size_class *class, unsigned long dst,
> >  		d_off += size;
> >  		d_size -= size;
> >  
> > +		/* Calling kunmap_atomic(d_addr) is necessary. kunmap_atomic() calls
> > +		 * must occurs in reverse order of calls to kmap_atomic().
> > +		 * So, to call kunmap_atomic(s_addr) we should first call kunmap_atomic(d_addr).
> > +		 * For more details see:
> > +		 * https://lore.kernel.org/linux-mm/5512421D.4000603@samsung.com/
> > +		 */
> 
> I'd drop the link part, Emails are not documentation, kmap_atomic
> is documented in Documentation/mm/highmem

I'll fix it in v2 patchset, but Andrew has already merged v1 patchset
into the mm-unstable branch.

-- 
Thank you,
Alexey