Replacing memset(<addr>,0,PAGE_SIZE) with clear_page() in kernel/kexec.c
Subsystems (3)
PATCH 1/1 Replacing memset(<addr>,0,PAGE_SIZE) with clear_page() in kernel/kexec.c
Hi,
Replacing memset(<addr>,0,PAGE_SIZE) with clear_page() in kernel/kexec.c
----
thanks.
kernel/kexec.c +1 -1
@@ -787,7 +787,7 @@ static int kimage_load_normal_segment(struct kimage *image, ptr =kmap (page);/* Start with a clear page */ -memset (ptr,0 ,PAGE_SIZE ); +clear_page (ptr); ptr += maddr & ~PAGE_MASK ; mchunk =PAGE_SIZE - (maddr & ~PAGE_MASK );if (mchunk > mbytes)
Signature · 1 line
Shani
kernel/kexec.c static int kimage_load_normal_segment(struct kimage *image, · line 790
Quoted 3 lines · Shani Moideen
ptr = kmap(page);kernel/kexec.c +1
-1-memset (ptr,0 ,PAGE_SIZE ); +clear_page (ptr);
I wonder if it's worth to invent kzmap() or something like that... ;)
/mjt
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
Quoted 3 lines · Shani Moideen
Quoted 3 lines
ptr = kmap(page);kernel/kexec.c +1
-1-memset (ptr,0 ,PAGE_SIZE ); +clear_page (ptr);
Quoted 1 line · Michael Tokarev
I wonder if it's worth to invent
kzmap()or something like that... ;)
I am counting 59 kmap + memset pairs in the kernel, so perhaps it is worth it to reduce kernel text size.
_______________________________________________
Kernel-janitors mailing list [email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
Quoted 10 lines · Pekka Enberg
Quoted 3 lines · Shani Moideen
Quoted 3 lines
ptr = kmap(page);kernel/kexec.c +1
-1-memset (ptr,0 ,PAGE_SIZE ); +clear_page (ptr);Quoted 1 line · Michael Tokarev
I wonder if it's worth to invent
kzmap()or something like that... ;)I am counting 59 kmap + memset pairs in the kernel, so perhaps it is worth it to reduce kernel text size.
Stuff of the sort already exists. Look for clear_highpage(), clear_user_highpage() and memclear_highpage_flush (recently renamed to zero_user_page, see -mm). But they all use kmap_atomic() -- kmap() variants would have to be added. Also, they're all inlines, so I'm not sure you'd be able to cut down text size, but still getting rid of open-coding is always good.
_______________________________________________
Kernel-janitors mailing list [email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
Quoted 12 lines · Satyam Sharma
Quoted 10 lines · Pekka Enberg
Quoted 3 lines · Shani Moideen
Quoted 3 lines
ptr = kmap(page);kernel/kexec.c +1
-1-memset (ptr,0 ,PAGE_SIZE ); +clear_page (ptr);Quoted 1 line · Michael Tokarev
I wonder if it's worth to invent
kzmap()or something like that... ;)I am counting 59 kmap + memset pairs in the kernel, so perhaps it is worth it to reduce kernel text size.
Quoted 6 lines
Stuff of the sort already exists. Look for
clear_highpage(),clear_user_highpage()andmemclear_highpage_flush(recently renamed tozero_user_page, see -mm). But they all usekmap_atomic()--kmap()variants would have to be added. Also, they're all inlines, so I'm not sure you'd be able to cut down text size, but still getting rid of open-coding is always good.
In this instance a clear_page variant should be ok. The combined variants are likely not because I use the mapping after it is cleared.
Eric
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
[KJ] Re: [KJ PATCH] Replacing memset(<addr>, 0,
In reply to Michael TokarevRegards,
Steve Newberger
QLogic Corporation
[email protected]
Please visit our web @
http://support.qlogic.com/
---- Original Message ----
From: [email protected]
Sent: 17-Jun-2007 22:33:56
To: [email protected]
Cc: [email protected]; [email protected]
Subject: [KJ PATCH] Replacing memset(<addr>,0,PAGE_SIZE) with clear_page(<addr>) in drivers/infiniband/hw/ipath/ipath_driver.c
Replacing memset(<addr>,0,PAGE_SIZE) with clear_page(<addr>) in drivers/infiniband/hw/ipath/ipath_driver.c
----
drivers/infiniband/hw/ipath/ipath_driver.c +1 -1
@@ -1509,7 +1509,7 @@ int ipath_create_rcvhdrq(struct ipath_devdata *dd,/* clear for security and sanity on each use */ memset (pd->port_rcvhdrq,0 , pd->port_rcvhdrq_size); -memset (pd->port_rcvhdrtail_kvaddr,0 ,PAGE_SIZE ); +clear_page (pd->port_rcvhdrtail_kvaddr);/* * tell chip each time we init it, even if we are re-using previous
Signature · 8 lines
Shani The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
[KJ] Re: [KJ PATCH] Replacing memset(<addr>, 0,
In reply to Michael Tokarevthanks, I applied both mthca patches as one commit.
_______________________________________________
REMINDER: this mailing list moved to vger.kernel.org and current one will be discontinued soon. To resubscribe, send email to [email protected] with
"subscribe kernel-janitors" in message body and follow instructions.
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors