From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754057Ab0KYQXu (ORCPT ); Thu, 25 Nov 2010 11:23:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:16109 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752546Ab0KYQXt (ORCPT ); Thu, 25 Nov 2010 11:23:49 -0500 Date: Thu, 25 Nov 2010 17:21:58 +0100 From: Andrea Arcangeli To: Linus Torvalds Cc: Mel Gorman , linux-mm@kvack.org, Andrew Morton , linux-kernel@vger.kernel.org, Marcelo Tosatti , Adam Litke , Avi Kivity , Hugh Dickins , Rik van Riel , Dave Hansen , Benjamin Herrenschmidt , Ingo Molnar , Mike Travis , KAMEZAWA Hiroyuki , Christoph Lameter , Chris Wright , bpicco@redhat.com, KOSAKI Motohiro , Balbir Singh , "Michael S. Tsirkin" , Peter Zijlstra , Johannes Weiner , Daisuke Nishimura , Chris Mason , Borislav Petkov Subject: Re: [PATCH 05 of 66] compound_lock Message-ID: <20101125162158.GO6118@random.random> References: <20101118114902.GJ8135@csn.ul.ie> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 18, 2010 at 09:28:27AM -0800, Linus Torvalds wrote: > On Thu, Nov 18, 2010 at 3:49 AM, Mel Gorman wrote: > >> + > >> +static inline void compound_lock_irqsave(struct page *page, > >> +                                      unsigned long *flagsp) > >> +{ > >> +#ifdef CONFIG_TRANSPARENT_HUGEPAGE > >> +     unsigned long flags; > >> +     local_irq_save(flags); > >> +     compound_lock(page); > >> +     *flagsp = flags; > >> +#endif > >> +} > >> + > > > > The pattern for spinlock irqsave passes in unsigned long, not unsigned > > long *. It'd be nice if they matched. > > Indeed. Just make the thing return the flags the way the normal > spin_lock_irqsave() function does. Done. diff --git a/include/linux/mm.h b/include/linux/mm.h --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -320,15 +320,14 @@ static inline void compound_unlock(struc #endif } -static inline void compound_lock_irqsave(struct page *page, - unsigned long *flagsp) +static inline unsigned long compound_lock_irqsave(struct page *page) { + unsigned long uninitialized_var(flags); #ifdef CONFIG_TRANSPARENT_HUGEPAGE - unsigned long flags; local_irq_save(flags); compound_lock(page); - *flagsp = flags; #endif + return flags; } static inline void compound_unlock_irqrestore(struct page *page, diff --git a/mm/swap.c b/mm/swap.c --- a/mm/swap.c +++ b/mm/swap.c @@ -94,7 +94,7 @@ static void put_compound_page(struct pag */ smp_mb(); /* page_head wasn't a dangling pointer */ - compound_lock_irqsave(page_head, &flags); + flags = compound_lock_irqsave(page_head); if (unlikely(!PageTail(page))) { /* __split_huge_page_refcount run before us */ compound_unlock_irqrestore(page_head, flags); Thanks, Andrea From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail144.messagelabs.com (mail144.messagelabs.com [216.82.254.51]) by kanga.kvack.org (Postfix) with SMTP id 3DE6B6B004A for ; Thu, 25 Nov 2010 11:23:01 -0500 (EST) Date: Thu, 25 Nov 2010 17:21:58 +0100 From: Andrea Arcangeli Subject: Re: [PATCH 05 of 66] compound_lock Message-ID: <20101125162158.GO6118@random.random> References: <20101118114902.GJ8135@csn.ul.ie> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: owner-linux-mm@kvack.org To: Linus Torvalds Cc: Mel Gorman , linux-mm@kvack.org, Andrew Morton , linux-kernel@vger.kernel.org, Marcelo Tosatti , Adam Litke , Avi Kivity , Hugh Dickins , Rik van Riel , Dave Hansen , Benjamin Herrenschmidt , Ingo Molnar , Mike Travis , KAMEZAWA Hiroyuki , Christoph Lameter , Chris Wright , bpicco@redhat.com, KOSAKI Motohiro , Balbir Singh , "Michael S. Tsirkin" , Peter Zijlstra , Johannes Weiner , Daisuke Nishimura , Chris Mason , Borislav Petkov List-ID: On Thu, Nov 18, 2010 at 09:28:27AM -0800, Linus Torvalds wrote: > On Thu, Nov 18, 2010 at 3:49 AM, Mel Gorman wrote: > >> + > >> +static inline void compound_lock_irqsave(struct page *page, > >> + unsigned long *flagsp) > >> +{ > >> +#ifdef CONFIG_TRANSPARENT_HUGEPAGE > >> + unsigned long flags; > >> + local_irq_save(flags); > >> + compound_lock(page); > >> + *flagsp = flags; > >> +#endif > >> +} > >> + > > > > The pattern for spinlock irqsave passes in unsigned long, not unsigned > > long *. It'd be nice if they matched. > > Indeed. Just make the thing return the flags the way the normal > spin_lock_irqsave() function does. Done. diff --git a/include/linux/mm.h b/include/linux/mm.h --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -320,15 +320,14 @@ static inline void compound_unlock(struc #endif } -static inline void compound_lock_irqsave(struct page *page, - unsigned long *flagsp) +static inline unsigned long compound_lock_irqsave(struct page *page) { + unsigned long uninitialized_var(flags); #ifdef CONFIG_TRANSPARENT_HUGEPAGE - unsigned long flags; local_irq_save(flags); compound_lock(page); - *flagsp = flags; #endif + return flags; } static inline void compound_unlock_irqrestore(struct page *page, diff --git a/mm/swap.c b/mm/swap.c --- a/mm/swap.c +++ b/mm/swap.c @@ -94,7 +94,7 @@ static void put_compound_page(struct pag */ smp_mb(); /* page_head wasn't a dangling pointer */ - compound_lock_irqsave(page_head, &flags); + flags = compound_lock_irqsave(page_head); if (unlikely(!PageTail(page))) { /* __split_huge_page_refcount run before us */ compound_unlock_irqrestore(page_head, flags); Thanks, Andrea -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/ Don't email: email@kvack.org