From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754809AbbIHOJL (ORCPT ); Tue, 8 Sep 2015 10:09:11 -0400 Received: from col004-omc4s14.hotmail.com ([65.55.34.216]:49880 "EHLO COL004-OMC4S14.hotmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754509AbbIHOJJ (ORCPT ); Tue, 8 Sep 2015 10:09:09 -0400 X-TMN: [SbhGQhuuTSZrIzqAkejFSU2pFxyr/MDh] X-Originating-Email: [xili_gchen_5257@hotmail.com] Message-ID: From: Chen Gang To: "oleg@redhat.com" CC: Andrew Morton , "kirill.shutemov@linux.intel.com" , "riel@redhat.com" , Michal Hocko , "sasha.levin@oracle.com" , "pfeiner@google.com" , "aarcange@redhat.com" , "vishnu.ps@samsung.com" , Linux Memory , kernel mailing list Subject: Re: [PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in get_unmapped_area() Date: Tue, 8 Sep 2015 22:09:08 +0800 Importance: Normal In-Reply-To: <55EEEC18.10101@hotmail.com> References: <20150907124148.GB32668@redhat.com>,<55EEEC18.10101@hotmail.com> Content-Type: text/plain; charset="gb2312" MIME-Version: 1.0 X-OriginalArrivalTime: 08 Sep 2015 14:09:08.0905 (UTC) FILETIME=[EDE8F190:01D0EA3F] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id t88E9HlN022272 On 9/7/15 20:41, Oleg Nesterov wrote: > On 09/05, Chen Gang wrote: >> >> From a1bf4726f71d6d0394b41309944646fc806a8a0c Mon Sep 17 00:00:00 2001 >> From: Chen Gang >> Date: Sat, 5 Sep 2015 21:51:08 +0800 >> Subject: [PATCH] mm/mmap.c: Remove redundent 'get_area' function pointer in >> get_unmapped_area() >> >> Call the function pointer directly, then let code a bit simpler. > ^^^^^^^^^^^^^^^^^^ > > This is subjective you know ;) > Oh, sorry. The comments need be improved. > I guess the author of this code added this variable to make the code > more readable. And to me it becomes less readable after your change. > > I leave this to you and maintainers. > OK, I can understand, every members have their own taste (my taste is if one buffering variable is used within 2 times, I want to remove it). For optimization, the original code maybe be a little better. So for me, if more than 20% members still like the original code, we should keep the original code no touch. Thanks. >> Signed-off-by: Chen Gang >> --- >> mm/mmap.c | 12 ++++++------ >> 1 file changed, 6 insertions(+), 6 deletions(-) >> >> diff --git a/mm/mmap.c b/mm/mmap.c >> index 4db7cf0..39fd727 100644 >> --- a/mm/mmap.c >> +++ b/mm/mmap.c >> @@ -2012,10 +2012,8 @@ unsigned long >> get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, >> unsigned long pgoff, unsigned long flags) >> { >> - unsigned long (*get_area)(struct file *, unsigned long, >> - unsigned long, unsigned long, unsigned long); >> - >> unsigned long error = arch_mmap_check(addr, len, flags); >> + >> if (error) >> return error; >> >> @@ -2023,10 +2021,12 @@ get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, >> if (len> TASK_SIZE) >> return -ENOMEM; >> >> - get_area = current->mm->get_unmapped_area; >> if (file && file->f_op->get_unmapped_area) >> - get_area = file->f_op->get_unmapped_area; >> - addr = get_area(file, addr, len, pgoff, flags); >> + addr = file->f_op->get_unmapped_area(file, addr, len, >> + pgoff, flags); >> + else >> + addr = current->mm->get_unmapped_area(file, addr, len, >> + pgoff, flags); >> if (IS_ERR_VALUE(addr)) >> return addr; >> >> -- >> 1.9.3 >> >> > -- Chen Gang (³Â¸Õ) Open, share, and attitude like air, water, and life which God blessed ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ¥Šwÿº{.nÇ+‰·¥Š{±þG«�éÿŠ{ayºʇڙë,j­¢f£¢·hš�ï�êÿ‘êçz_è®(­éšŽŠÝ¢j"�ú¶m§ÿÿ¾«þG«�éÿ¢¸?™¨è­Ú&£ø§~�á¶iO•æ¬z·švØ^¶m§ÿÿà ÿ¶ìÿ¢¸?–I¥