From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omr1.cc.ipv6.vt.edu ([2607:b400:92:8300:0:c6:2117:b0e] helo=omr1.cc.vt.edu) by shelob.surriel.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1gNLvt-0001nb-Lx for kernelnewbies@kernelnewbies.org; Thu, 15 Nov 2018 13:00:01 -0500 Received: from mr5.cc.vt.edu (mr5.cc.vt.edu [IPv6:2607:b400:92:8400:0:72:232:758b]) by omr1.cc.vt.edu (8.14.4/8.14.4) with ESMTP id wAFHxxD7030582 for ; Thu, 15 Nov 2018 12:59:59 -0500 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by mr5.cc.vt.edu (8.14.7/8.14.7) with ESMTP id wAFHxs1s004855 for ; Thu, 15 Nov 2018 12:59:59 -0500 Received: by mail-qk1-f198.google.com with SMTP id s19so46497778qke.20 for ; Thu, 15 Nov 2018 09:59:59 -0800 (PST) From: valdis.kletnieks@vt.edu To: "Larry" Subject: Re: a question on mapping from PTE to swap entry In-Reply-To: References: Mime-Version: 1.0 Date: Thu, 15 Nov 2018 12:59:52 -0500 Message-ID: <33940.1542304792@turing-police.cc.vt.edu> Cc: kernelnewbies List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============1156730142816702427==" Errors-To: kernelnewbies-bounces@kernelnewbies.org Message-ID: <20181115175952.qUntF-Mh5sGBEILD86o59wrH9gjSozDcAReBYdRcTrY@z> --===============1156730142816702427== Content-Type: multipart/signed; boundary="==_Exmh_1542304792_2379P"; micalg=pgp-sha1; protocol="application/pgp-signature" Content-Transfer-Encoding: 7bit --==_Exmh_1542304792_2379P Content-Type: text/plain; charset=us-ascii On Thu, 15 Nov 2018 23:53:56 +0800, "Larry" said: > I'm curious when multiple process has the same PTE which points to the samepage, > how can kernel differenciate which page from swap space should be swappedin? The PTE tells where in /dev/swap to find the page. If it's a shared page, the references all point at the same place, so "process 1's PAGE_A info" is the same as "process 2's PAGE_A" info. They may have different addresses in the two processes, but they're both referencing the same swap page. > Process 2 get scheduled, PAGE_A was from Process 1, so it should be swapped out Why? In general, there's no need to do so - and if it's shared, it's probably a hot page so it won't be chosen for swapout. (Remember - the kernel doesn't do swapin/swapout decisions in schedule(), it only takes action once Process 2 starts running and references a page that requires something be done. --==_Exmh_1542304792_2379P Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Comment: Exmh version 2.9.0 11/07/2018 iQEVAwUBW+20GI0DS38y7CIcAQIg2Af9EtkN+RRcoKhGdDLc+EnRCkmKmwDxHoGy mDKPp0HBUX0RnHQ0xGRmBwGqmupQcsucx4UrP02HLKHaTOkBYkvb1tDDYXS9p4eC UvYhPOlTjfr/+AcAGrYxPHlXMlWrpcYOeDCuBJIJmKaymphlc3/2VzvQvztZOwwW 5Y5TMdDNoopFDW4yjhoztFhGoLIyretSvfL4w8WQNzulkN7dwfDOuF1rSTGYZs9k O+rcVLnWHohZ+iX7C9q17cCAq//Z+I1KzHuUUr7SYp5moN6Nj/NXSmrZuGn+Lvzw CgD7+h+xGU5Ihyrs/07eAiKUtIyOdrGkagx4Xo0ggqDqVRsd8Ja1WQ== =Snl2 -----END PGP SIGNATURE----- --==_Exmh_1542304792_2379P-- --===============1156730142816702427== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies --===============1156730142816702427==--