From owner-freebsd-hackers@FreeBSD.ORG Thu Sep 10 06:55:57 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 77FB1106566B for ; Thu, 10 Sep 2009 06:55:57 +0000 (UTC) (envelope-from guomingyan@gmail.com) Received: from mail-ew0-f208.google.com (mail-ew0-f208.google.com [209.85.219.208]) by mx1.freebsd.org (Postfix) with ESMTP id 0F45A8FC15 for ; Thu, 10 Sep 2009 06:55:56 +0000 (UTC) Received: by ewy4 with SMTP id 4so46332ewy.36 for ; Wed, 09 Sep 2009 23:55:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:cc:content-type; bh=/iep6HpKpJcqErenzwyaOadoxp17hjbJkHPLZhI57PU=; b=Yd/Am6pxWv8xeQwhEoKnKO0oDX61OakPa4r1QpKBgZ86s0YR7dnIJJZNlqd+1sRVqG a04VmQdYw+C/64rOdI9HFqgy55P/P5yArD1mzDEam80iUZtoEa/0OBwl2JvX1sm260sb k9vGm8BJAX+UH/L0vxLPlXyVLQegaePYjrQm8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:cc:content-type; b=LrHvrh9UOcDwCUSlYCO8kP1MeBPlCn+19K9efzhExAgFJRa2mhA5QG5AA++9Vx3AkQ TOdz4uyN0hiLoFWsf8wUE3Lfqju1GdAx0EKASbYveGdTJdx5cFSulriA7UDvgMsbfGUE Tx4pY40mfsbnO8v8/dSq+dQTFeGK/TlHvtu+I= MIME-Version: 1.0 Received: by 10.210.9.5 with SMTP id 5mr432788ebi.78.1252564013540; Wed, 09 Sep 2009 23:26:53 -0700 (PDT) Date: Wed, 9 Sep 2009 23:26:53 -0700 Message-ID: <1fa17f810909092326l1271df94t1dea5ac9d5deba1b@mail.gmail.com> From: MingyanGuo To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: LI Xin Subject: How to prevent other CPU from accessing a set of pages before calling pmap_remove_all function X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Sep 2009 06:55:57 -0000 Hi all, I find that function pmap_remove_all for arch amd64 works with a time window between reading & clearing the PTE flags(access flag and dirty flag) and invalidating its TLB entry on other CPU. After some discussion with Li Xin(cced), I think all the processes that are using the PTE being removed should be blocked before calling pmap_remove_all, or other CPU may dirty the page but does not set the dirty flag before the TLB entry is flushed. But I can not find how to block them to call the function. I read the function vm_pageout_scan in file vm/vm_pageout.c but can not find the exact method it used. Or I just misunderstood the semantics of function pmap_remove_all ? Thanks in advance. Regards, MingyanGuo