From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754573Ab2IBS1H (ORCPT ); Sun, 2 Sep 2012 14:27:07 -0400 Received: from cantor2.suse.de ([195.135.220.15]:56707 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754261Ab2IBS1F (ORCPT ); Sun, 2 Sep 2012 14:27:05 -0400 Date: Sun, 2 Sep 2012 20:26:56 +0200 (CEST) From: Jiri Kosina To: Xin Tong Cc: linux-kernel Subject: Re: linux page table In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2 Sep 2012, Xin Tong wrote: > >> 3. can two different processes have their CR3 being the same value > >> even though they have different first level page tables ? > > > > Yes, if they are created by clone(CLONE_VM). In such case they share the > > same mm_struct, and therefore mm_struct->pgd (which is exactly what is > > loaded into cr3 in switch_mm()) is the same. > > > > Is this the COW mechanism in linux. what if the cloned process need to > have set of its own pages later. do the CR3s for the 2 processes > become different at that point ? That is a different story. COW is applied on fork() (i.e. spawning new process), not on clone(CLONE_VM) (i.e. spawning new thread). -- Jiri Kosina SUSE Labs