On Tue, 14 Aug 2007, Arjan van de Ven wrote:But that doesn't come free of cost, does it, seeing we've now pushed the conditional inside kfree() itself. kfree() isn't inlined so we do save on space but lose out on the extra time overhead for the common case. Speaking of which ... [PATCH] {slub, slob}: use unlikely() for kfree(ZERO_OR_NULL_PTR) check Considering kfree(NULL) would normally occur only in error paths and kfree(ZERO_SIZE_PTR) is uncommon as well, so let's use unlikely() for the condition check in SLUB's and SLOB's kfree() to optimize for the common case. SLAB has this already. Signed-off-by: Satyam Sharma <satyam@infradead.org> --- mm/slob.c | 2 +- mm/slub.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/slob.c b/mm/slob.c index ec33fcd..37a8b9a 100644 --- a/mm/slob.c +++ b/mm/slob.c @@ -466,7 +466,7 @@ void kfree(const void *block) { struct slob_page *sp; - if (ZERO_OR_NULL_PTR(block)) + if (unlikely(ZERO_OR_NULL_PTR(block))) return; sp = (struct slob_page *)virt_to_page(block); diff --git a/mm/slub.c b/mm/slub.c index 69d02e3..3788537 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -2467,7 +2467,7 @@ void kfree(const void *x) * this comparison would be true for all "negative" pointers * (which would cover the whole upper half of the address space). */ - if (ZERO_OR_NULL_PTR(x)) + if (unlikely(ZERO_OR_NULL_PTR(x))) return; page = virt_to_head_page(x); -
| Frank Ch. Eigler | Re: kgdb in git-x86#mm review |
| Lev A. Melnikovsky | ehci-hcd affects hda speed |
| Ingo Molnar | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| AndrewL733 | NMI error and Intel S5000PSL Motherboards |
git: | |
| Sven Verdoolaege | Re: repo.or.cz wishes? |
| Junio C Hamano | Re: [PATCH] Teach remote machinery about remotes.default config variable |
| Steffen Prohaska | Re: New features in gitk |
| Deskin Miller | Re: multiple-commit cherry-pick? |
| frantisek holop | (open)smtpd, the mystery smtpd daemon |
| Richard Stallman | Real men don't attack straw men |
| Nick Guenther | Re: When will OpenBSD support UTF8? |
| Kevin Neff | Patching a SSH 'Weakness' |
| Jim Winstead Jr. | Re: Root Disk/Book Disk Compatibility |
| Arthur Recktenwald | rcmd: socket: Permission denied |
| David Fox | Mule: Chinese/Japanese/English/Thai version of x11emacs-18.58 |
| Framstag | ftp-error: bind: Address already in use? |
