From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx110.postini.com [74.125.245.110]) by kanga.kvack.org (Postfix) with SMTP id F127B6B004D for ; Fri, 30 Dec 2011 03:48:45 -0500 (EST) Message-ID: <4EFD7AE3.8020403@tao.ma> Date: Fri, 30 Dec 2011 16:48:35 +0800 From: Tao Ma MIME-Version: 1.0 Subject: Re: [PATCH] mm: do not drain pagevecs for mlock References: <1325226961-4271-1-git-send-email-tm@tao.ma> In-Reply-To: Content-Type: multipart/mixed; boundary="------------070102030707020608010108" Sender: owner-linux-mm@kvack.org List-ID: To: KOSAKI Motohiro Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, David Rientjes , Minchan Kim , Mel Gorman , Johannes Weiner , Andrew Morton This is a multi-part message in MIME format. --------------070102030707020608010108 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 12/30/2011 04:11 PM, KOSAKI Motohiro wrote: > 2011/12/30 Tao Ma : >> In our test of mlock, we have found some severe performance regression >> in it. Some more investigations show that mlocked is blocked heavily >> by lur_add_drain_all which calls schedule_on_each_cpu and flush the work >> queue which is very slower if we have several cpus. >> >> So we have tried 2 ways to solve it: >> 1. Add a per cpu counter for all the pagevecs so that we don't schedule >> and flush the lru_drain work if the cpu doesn't have any pagevecs(I >> have finished the codes already). >> 2. Remove the lru_add_drain_all. >> >> The first one has some problems since in our product system, all the cpus >> are busy, so I guess there is very little chance for a cpu to have 0 pagevecs >> except that you run several consecutive mlocks. >> >> From the commit log which added this function(8891d6da), it seems that we >> don't have to call it. So the 2nd one seems to be both easy and workable and >> comes this patch. > > Could you please show us your system environment and benchmark programs? > Usually lru_drain_** is very fast than mlock() body because it makes > plenty memset(page). The system environment is: 16 core Xeon E5620. 24G memory. I have attached the program. It is very simple and just uses mlock/munlock. Thanks Tao --------------070102030707020608010108 Content-Type: text/x-csrc; name="test_mlock.c" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="test_mlock.c" #include #include #include #include #include #include #include #define MM_SZ1 24 #define MM_SZ2 56 #define MM_SZ3 4168 void mlock_test() { char ptr1[MM_SZ1]; char ptr2[MM_SZ2]; char ptr3[MM_SZ3]; if(0 != mlock(ptr1, MM_SZ1) ) perror("mlock MM_SZ1\n"); if(0 != mlock(ptr2, MM_SZ2) ) perror("mlock MM_SZ2\n"); if(0 != mlock(ptr3, MM_SZ3) ) perror("mlock MM_SZ3\n"); if(0 != munlock(ptr1, MM_SZ1) ) perror("munlock MM_SZ1\n"); if(0 != munlock(ptr2, MM_SZ2) ) perror("munlock MM_SZ2\n"); if(0 != munlock(ptr3, MM_SZ3) ) perror("munlock MM_SZ3\n"); } int main(int argc, char *argv[]) { int ret, opt; int i,cnt; while((opt = getopt(argc, argv, "c:")) != -1 ) { switch(opt){ case 'c': cnt = atoi(optarg); break; default: printf("Usage: %s [-c count] arg...\n", argv[0]); exit(EXIT_FAILURE); } } for(i = 0; i < cnt; i++) mlock_test(); return 0; } --------------070102030707020608010108-- -- 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/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: email@kvack.org