From patchwork Sun Sep 26 16:12:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nadav Amit X-Patchwork-Id: 12518939 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FBD1C4332F for ; Sun, 26 Sep 2021 23:44:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id ED76761151 for ; Sun, 26 Sep 2021 23:43:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org ED76761151 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id D28036B0075; Sun, 26 Sep 2021 19:43:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CB0F66B0078; Sun, 26 Sep 2021 19:43:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B0507900002; Sun, 26 Sep 2021 19:43:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0027.hostedemail.com [216.40.44.27]) by kanga.kvack.org (Postfix) with ESMTP id 9E67B6B0075 for ; Sun, 26 Sep 2021 19:43:58 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 4941B181B04B5 for ; Sun, 26 Sep 2021 23:43:58 +0000 (UTC) X-FDA: 78631354956.15.9FEBE01 Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) by imf07.hostedemail.com (Postfix) with ESMTP id ECD86100009E for ; Sun, 26 Sep 2021 23:43:57 +0000 (UTC) Received: by mail-pj1-f43.google.com with SMTP id rm6-20020a17090b3ec600b0019ece2bdd20so2306531pjb.1 for ; Sun, 26 Sep 2021 16:43:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0dVwIqoXrWYrBeh50L+yTf5lQAryqwYLoi0T5EzujgU=; b=H90hDEbMYLTnjkduq4ioXC3Q6x4/kREz9IaMVmY4/QEAYpTVnrObJL0XyucVJgD0aE EroOvxTubIUR87F0ETk3/AfezkybAt06QkLRvFwNPeOWs900MrsK69QBOKmj+3uAXqlu 76kIT0uPgs6y4eusRE9/4nKXyhs1PGnvHYzON1LLB6G3EKMkCz/HK3ES3vT2s8hooQ3A mPWEj+92GHVCaZme0s8KuSghaNpssd2ip2J3WBBlw0Li8DqNYFJ/qMbbVP8F9bJqPTTJ DYHtU+uKxiX7VF0Yucv9b5C2pNn8OECmb/XmfH+qEyf2ICr+/DhjNMsNc0gydewwR2Zl McOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0dVwIqoXrWYrBeh50L+yTf5lQAryqwYLoi0T5EzujgU=; b=rA+Nf6Nas3kw+qb8ahrYHyx/WZ0sGrEWYDnfwr7U/xbMOXfIXgE+M++oTP0wYzLPCX 59iwWiIEKqJwVQLQO1SWcS+MgWeAKLAyzenwjU+1NyGwRJ8uVTrcm/QABxKxtjxyi5FJ LmKw2BjYiy8Y0unFsypA+3VqmB5GDNgy6J+8ZfxVp30csw5WRScmSbLygWhKswbcuCYK TrBXGBn3gRwsxZnqfkIIENoh+CiM/GTdW9/TJYuZNKMaB1vA0AGn+N+JcsnBhBdjaDYC ITTluojHAGTMVFz7MhKkC9+zIT1RJdncoVUQ1zVAzPoMeF9JkJNQV+0oDT5pZFEK9OiW Vssw== X-Gm-Message-State: AOAM530zDBi3p097OP8N+KenFt8bzwfhQItpGj6F47gQ23vqNUEly1Ko 1JXewuOuPA6vEH9r27GADMg= X-Google-Smtp-Source: ABdhPJyRIFjbZLc5BHV5apUrQUvzT/e1HBNNhmP+BETtZps1zARdLAa0dGFFMUZLxRSGC2M1VfACxw== X-Received: by 2002:a17:90b:1bd1:: with SMTP id oa17mr16386548pjb.82.1632699836897; Sun, 26 Sep 2021 16:43:56 -0700 (PDT) Received: from sc2-haas01-esx0118.eng.vmware.com ([66.170.99.1]) by smtp.gmail.com with ESMTPSA id n22sm16783686pgc.55.2021.09.26.16.43.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Sep 2021 16:43:56 -0700 (PDT) From: Nadav Amit X-Google-Original-From: Nadav Amit To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Peter Xu , Nadav Amit , Andrea Arcangeli , Minchan Kim , Colin Cross , Suren Baghdasarya , Mike Rapoport Subject: [RFC PATCH 2/8] mm/madvise: remove unnecessary check on madvise_dontneed_free() Date: Sun, 26 Sep 2021 09:12:53 -0700 Message-Id: <20210926161259.238054-3-namit@vmware.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210926161259.238054-1-namit@vmware.com> References: <20210926161259.238054-1-namit@vmware.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: ECD86100009E X-Stat-Signature: kcdea571s47gwofap61ihn8xunypptdh Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=H90hDEbM; spf=none (imf07.hostedemail.com: domain of mail-pj1-f43.google.com has no SPF policy when checking 209.85.216.43) smtp.helo=mail-pj1-f43.google.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam06 X-HE-Tag: 1632699837-811065 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Nadav Amit madvise_dontneed_free() is called only from madvise_vma() and the behavior is always either MADV_FREE or MADV_DONTNEED. There is no need to check again in madvise_dontneed_free() if the behavior is any different. Cc: Andrea Arcangeli Cc: Andrew Morton Cc: Minchan Kim Cc: Colin Cross Cc: Suren Baghdasarya Cc: Mike Rapoport Signed-off-by: Nadav Amit --- mm/madvise.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mm/madvise.c b/mm/madvise.c index a2b05352ebfe..fe843513a4e8 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -820,10 +820,8 @@ static long madvise_dontneed_free(struct vm_area_struct *vma, if (behavior == MADV_DONTNEED) return madvise_dontneed_single_vma(vma, start, end); - else if (behavior == MADV_FREE) + else /* behavior == MADV_FREE */ return madvise_free_single_vma(vma, start, end); - else - return -EINVAL; } static long madvise_populate(struct vm_area_struct *vma,