Replacing memset(<addr>,0,PAGE_SIZE) with clear_page() in mm/memory.c
Subsystems (5)
PATCH 1/1 Replacing memset(<addr>,0,PAGE_SIZE) with clear_page() in mm/memory.c
Hi,
Replacing memset(<addr>,0,PAGE_SIZE) with clear_page() in mm/memory.c.
----
thanks.
mm/memory.c +1 -1
@@ -1505,7 +1505,7 @@ static inline void cow_user_page(struct page *dst, struct page *src, unsigned lo* zeroes. */ if (__copy_from_user_inatomic (kaddr, uaddr,PAGE_SIZE )) -memset (kaddr,0 ,PAGE_SIZE ); +clear_page (kaddr);kunmap_atomic (kaddr,KM_USER0 );flush_dcache_page (dst);return ;
Signature · 7 lines
Shani -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 17 lines · Shani Moideen
Hi,
Replacing
memset(<addr>,0,PAGE_SIZE)withclear_page()inmm/memory.c.Signed-off-by Shani Moideen <[email protected]>----
thanks.
mm/memory.c +0
-0
mm/memory.c static inline void cow_user_page(struct page *dst, struct page *src, unsigned lo · line 1511
Quoted 8 lines
mm/memory.c +1
-1@@ -1505,7 +1505,7 @@ static inline void cow_user_page(struct page *dst, struct page *src, unsigned lo* zeroes. */ if (__copy_from_user_inatomic (kaddr, uaddr,PAGE_SIZE )) -memset (kaddr,0 ,PAGE_SIZE ); +clear_page (kaddr);kunmap_atomic (kaddr,KM_USER0 );flush_dcache_page (dst);return ;
This looks to be whitespace dammaged?
-apw
use tabs not spaces
PATCH: -:64:
FILE: b/mm/memory.c:1508:
+ clear_page(kaddr);$
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
PATCH 1/1 Replacing memset(<addr>,0,PAGE_SIZE) with
In reply to Shani MoideenReplacing memset(<addr>,0,PAGE_SIZE) with clear_page(<addr>) in drivers/char/drm/i810_dma.c
----
drivers/char/drm/i810_dma.c +1 -1
@@ -413,7 +413,7 @@ static int i810_dma_initialize(drm_device_t * dev,DRM_ERROR ("Can not allocate hardware status page\n" );return -ENOMEM ; } -memset (dev_priv->hw_status_page,0 ,PAGE_SIZE ); +clear_page (dev_priv->hw_status_page);DRM_DEBUG ("hw status page @ %p\n" , dev_priv->hw_status_page);I810_WRITE (0x02080 , dev_priv->dma_status_page);
Signature · 5 lines
Shani _______________________________________________ Kernel-janitors mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
PATCH 1/1 Replacing memset(<addr>,0,PAGE_SIZE) with
In reply to Shani MoideenReplacing memset(<addr>,0,PAGE_SIZE) with clear_page(<addr>) in drivers/char/drm/i830_dma.c
----
drivers/char/drm/i830_dma.c +1 -1
@@ -433,7 +433,7 @@ static int i830_dma_initialize(drm_device_t * dev,DRM_ERROR ("Can not allocate hardware status page\n" );return -ENOMEM ; } -memset (dev_priv->hw_status_page,0 ,PAGE_SIZE ); +clear_page (dev_priv->hw_status_page);DRM_DEBUG ("hw status page @ %p\n" , dev_priv->hw_status_page);I830_WRITE (0x02080 , dev_priv->dma_status_page);
Signature · 5 lines
Shani _______________________________________________ Kernel-janitors mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
PATCH 1/1 Replacing memset(<addr>,0,PAGE_SIZE) with
In reply to Shani MoideenReplacing memset(<addr>,0,PAGE_SIZE) with clear_page(<addr>) in drivers/char/drm/i915_dma.c
----
drivers/char/drm/i915_dma.c +1 -1
@@ -191,7 +191,7 @@ static int i915_initialize(drm_device_t * dev, dev_priv->hw_status_page = dev_priv->status_page_dmah->vaddr; dev_priv->dma_status_page = dev_priv->status_page_dmah->busaddr; -memset (dev_priv->hw_status_page,0 ,PAGE_SIZE ); +clear_page (dev_priv->hw_status_page);DRM_DEBUG ("hw status page @ %p\n" , dev_priv->hw_status_page);I915_WRITE (0x02080 , dev_priv->dma_status_page);
Signature · 5 lines
Shani _______________________________________________ Kernel-janitors mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
PATCH 1/1 Replacing memset(<addr>,0,PAGE_SIZE) with
In reply to Shani MoideenReplacing memset(<addr>,0,PAGE_SIZE) with clear_page(<addr>) in drivers/infiniband/hw/mthca/mthca_allocator.c
----
drivers/infiniband/hw/mthca/mthca_allocator.c +1 -1
@@ -255,7 +255,7 @@ int mthca_buf_alloc(struct mthca_dev *dev, int size, int max_direct, dma_list[i] = t;pci_unmap_addr_set (&buf->page_list[i], mapping, t); -memset (buf->page_list[i].buf,0 ,PAGE_SIZE ); +clear_page (buf->page_list[i].buf); } }
Signature · 5 lines
Shani _______________________________________________ Kernel-janitors mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
PATCH 1/1 Replacing memset(<addr>,0,PAGE_SIZE) with
In reply to Shani MoideenReplacing memset(<addr>,0,PAGE_SIZE) with clear_page(<addr>) in drivers/infiniband/hw/mthca/mthca_eq.c
----
drivers/infiniband/hw/mthca/mthca_eq.c +1 -1
@@ -522,7 +522,7 @@ static int mthca_create_eq(struct mthca_dev *dev, dma_list[i] = t;pci_unmap_addr_set (&eq->page_list[i], mapping, t); -memset (eq->page_list[i].buf,0 ,PAGE_SIZE ); +clear_page (eq->page_list[i].buf); }for (i =0 ; i < eq->nent; ++i)
Signature · 5 lines
Shani _______________________________________________ Kernel-janitors mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
PATCH 1/1 Replacing memset(<addr>,0,PAGE_SIZE) with
In reply to Shani MoideenReplacing 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 · 5 lines
Shani _______________________________________________ Kernel-janitors mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
Re: [KJ] [KJ PATCH] Replacing memset(<addr>,0,PAGE_SIZE) with
In reply to Shani MoideenOn Mon, 18 Jun 2007, Shani Moideen wrote:
...
Review
Quoted 2 lines
(quoted diff) +1
-1- memset(buf->page_list[i].buf, 0, PAGE_SIZE); + clear_page(buf->page_list[i].buf);
...
i'm not sure whether this current cleanup project was at all inspired by the page at the wiki:
http://fsdev.net/wiki/index.php?title=Clear_page_copy_page
note that there are two sort of related cleanups -- clear_page() and copy_page(). but, as you can read there, it's not *entirely* clear that the clears or copies are entirely equivalent to the corresponding memset() or memcpy() calls (or whether they should be).
calling memset() for a size of PAGE_SIZE doesn't necessarily mean that the address is on a page boundary, while it's possible that something called "clear_page()" is *meant* to work only on an actual page. that's not what appears to be happening, but it's something to keep in
mind: *should* something called "clear_page()" have any extra semantics above and beyond just clearing something that's the size of a page?
and the same thing can be asked of "copy_page()". i'm not saying that there's anything amiss with the current cleaning, and i'm happy to see it happening. i'm just curious as to whether the possible semantic ambiguity has been examined and dismissed.
rday
Signature · 11 lines
==================================== Robert P. J. Day Linux Consulting, Training and Annoying Kernel Pedantry Waterloo, Ontario, CANADA http://fsdev.net/wiki/index.php?title=Main_Page ==================================== _______________________________________________ Kernel-janitors mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors