Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754117AbbH0SGM (ORCPT ); Thu, 27 Aug 2015 14:06:12 -0400 Received: from mail-wi0-f170.google.com ([209.85.212.170]:37299 "EHLO mail-wi0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751635AbbH0SGK (ORCPT ); Thu, 27 Aug 2015 14:06:10 -0400 Date: Thu, 27 Aug 2015 20:06:07 +0200 From: Michal Hocko To: Hugh Dickins Cc: "Paul E. McKenney" , Vlastimil Babka , "Kirill A. Shutemov" , Andrew Morton , "Kirill A. Shutemov" , Andrea Arcangeli , Dave Hansen , Johannes Weiner , David Rientjes , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Christoph Lameter Subject: Re: [PATCHv3 4/5] mm: make compound_head() robust Message-ID: <20150827180606.GA29584@dhcp22.suse.cz> References: <55DC550D.5060501@suse.cz> <20150825183354.GC4881@node.dhcp.inet.fi> <20150825201113.GK11078@linux.vnet.ibm.com> <55DCD434.9000704@suse.cz> <20150825211954.GN11078@linux.vnet.ibm.com> <20150826212916.GG11078@linux.vnet.ibm.com> <20150827150917.GF27052@dhcp22.suse.cz> <20150827160355.GI27052@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1638 Lines: 43 On Thu 27-08-15 10:28:48, Hugh Dickins wrote: > On Thu, 27 Aug 2015, Michal Hocko wrote: > > On Thu 27-08-15 17:09:17, Michal Hocko wrote: > > [...] > > > Btw. Do we need the same think for page::mapping and KSM? > > > > I guess we are safe here because the address for mappings comes from > > kmalloc and that aligned properly, right? > > Not quite right, in fact. Because usually the struct address_space > is embedded within the struct inode (at i_data), and the struct inode > embedded within the fs-dependent inode, and that's what's kmalloc'ed. > > What makes the mapping pointer low bits safe is include/linux/fs.h: > struct address_space { > ... > } __attribute__((aligned(sizeof(long)))); Oh, right you are. > Which we first had to add in for the cris architecture, which stumbled > not on a genuine allocated address_space, but on that funny statically > declared swapper_space in mm/swap_state.c. Thanks for the clarification. > But struct anon_vma and KSM's struct stable_node (which depend on > the same scheme for low bits of page->mapping) have no such alignment > attribute specified: those ones are indeed relying on the kmalloc > guarantee as you suppose. > > Does struct rcu_head have no __attribute__((aligned(whatever)))? > Perhaps that attribute should be added when it's needed. That's basically what I meant in the previous email. -- Michal Hocko SUSE Labs -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/