Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755642AbdDRN2X (ORCPT ); Tue, 18 Apr 2017 09:28:23 -0400 Received: from resqmta-ch2-04v.sys.comcast.net ([69.252.207.36]:48354 "EHLO resqmta-ch2-04v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752255AbdDRN2U (ORCPT ); Tue, 18 Apr 2017 09:28:20 -0400 Date: Tue, 18 Apr 2017 08:28:17 -0500 (CDT) From: Christoph Lameter X-X-Sender: cl@east.gentwo.org To: Sergey Senozhatsky cc: Minchan Kim , Joonsoo Kim , Andrew Morton , Michal Hocko , Vlastimil Babka , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@lge.com, Sergey Senozhatsky Subject: Re: copy_page() on a kmalloc-ed page with DEBUG_SLAB enabled (was "zram: do not use copy_page with non-page alinged address") In-Reply-To: <20170418104222.GB558@jagdpanzerIV.localdomain> Message-ID: References: <20170417014803.GC518@jagdpanzerIV.localdomain> <20170418104222.GB558@jagdpanzerIV.localdomain> Content-Type: text/plain; charset=US-ASCII X-CMAE-Envelope: MS4wfEXpwRCMLCFDkGHq1JcbVhJA+yTirz5jAjEw3QOaVWj724tWKRpAwQLfpyXlcMZygUaGL/DtRSVXfRECJsfwFw5d5ODBdAKkbPWSEtEBzcQ6sXgArN0c S5f52p18X2TK+H4X095GGMnyTR1GiqzyaQuNywME5FZeodp+bYeyYXSBQaElJr5oUxBdIcnZZEB8k9sccHqcn6VSYTtYSGEnhbVdnYZAJHNNMcTeu4qP9SHI D4bdPARfpG2l3NUqLo+l9aOoU7p/T33Ow3K5GU/BWwsNRTuRzFxRE8Q0YgsVKr5/dBR5K9//F58Yzmt7gPKHgnJm4Gte/nwxe5CuMtLHeHThuw7lAH/PpbwK foko9SPejncnEEEejppnPwlJdJ2BExKWT6/61yGn+lBKLe3QsoxSpfOBGQmzaZvItuBw+e0wiuqnWSEzpmSB3VI1q3Gw94HLVLrRMh5RcLIqbWd367vTxgFW pfo2qs7k92Lgg7uQ Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 966 Lines: 25 On Tue, 18 Apr 2017, Sergey Senozhatsky wrote: > > Simple solution is to not allocate pages via the slab allocator but use > > the page allocator for this. The page allocator provides proper alignment. > > sure, but at the same time it's not completely uncommon and unseen thing > > ~/_next$ git grep kmalloc | grep PAGE_SIZE | wc -l > 75 Of course if you want a PAGE_SIZE object that is not really page aligned etc then its definitely ok to use. > not all, if any, of those pages get into copy_page(), of course. may be... hopefully. > so may be a warning would make sense and save time some day. but up to MM > people to decide. Slab objects are copied using memcpy. copy_page is for pages aligned to page boundaries and the arch code there may have additional expectations that cannot be met by the slab allocators. > p.s. Christoph, FYI, gmail automatically marked your message > as a spam message, for some reason. Weird. Any more details as to why?