From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f178.google.com (mail-pf0-f178.google.com [209.85.192.178]) by kanga.kvack.org (Postfix) with ESMTP id A19E66B0255 for ; Sun, 21 Feb 2016 21:57:18 -0500 (EST) Received: by mail-pf0-f178.google.com with SMTP id c10so87275760pfc.2 for ; Sun, 21 Feb 2016 18:57:18 -0800 (PST) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com. [58.251.152.64]) by mx.google.com with ESMTPS id rq5si31008321pab.126.2016.02.21.18.57.17 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 21 Feb 2016 18:57:18 -0800 (PST) Message-ID: <56CA78F7.9010201@huawei.com> Date: Mon, 22 Feb 2016 10:56:55 +0800 From: Xishi Qiu MIME-Version: 1.0 Subject: [RFC] mm: why we should clear page when do anonymous page fault Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: Linux MM , LKML handle_pte_fault() do_anonymous_page() alloc_zeroed_user_highpage_movable() We will alloc a zeroed page when do anonymous page fault, I don't know why should clear it? just for safe? If user space program do like the following, there are two memset 0, right? kernel alloc zeroed page, and user memset 0 it again, this will waste a lot of time. main() { ... vaddr = malloc(size) if (vaddr) memset(vaddr, 0, size); ... } Thanks, Xishi Qiu -- 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/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753414AbcBVC5Q (ORCPT ); Sun, 21 Feb 2016 21:57:16 -0500 Received: from szxga01-in.huawei.com ([58.251.152.64]:38391 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753400AbcBVC5O (ORCPT ); Sun, 21 Feb 2016 21:57:14 -0500 Message-ID: <56CA78F7.9010201@huawei.com> Date: Mon, 22 Feb 2016 10:56:55 +0800 From: Xishi Qiu User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Linux MM , LKML Subject: [RFC] mm: why we should clear page when do anonymous page fault Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.25.179] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020202.56CA7903.0047,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: fc719ed4f6dbe08607448b10fc4b8392 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org handle_pte_fault() do_anonymous_page() alloc_zeroed_user_highpage_movable() We will alloc a zeroed page when do anonymous page fault, I don't know why should clear it? just for safe? If user space program do like the following, there are two memset 0, right? kernel alloc zeroed page, and user memset 0 it again, this will waste a lot of time. main() { ... vaddr = malloc(size) if (vaddr) memset(vaddr, 0, size); ... } Thanks, Xishi Qiu