From mboxrd@z Thu Jan 1 00:00:00 1970 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 60A38C433FE for ; Mon, 27 Sep 2021 20:36:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E01C3611C2 for ; Mon, 27 Sep 2021 20:36:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E01C3611C2 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 5ABF16B0071; Mon, 27 Sep 2021 16:36:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 534186B0072; Mon, 27 Sep 2021 16:36:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4230C6B0073; Mon, 27 Sep 2021 16:36:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0041.hostedemail.com [216.40.44.41]) by kanga.kvack.org (Postfix) with ESMTP id 35CAA6B0071 for ; Mon, 27 Sep 2021 16:36:24 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id EC715181DF777 for ; Mon, 27 Sep 2021 20:36:23 +0000 (UTC) X-FDA: 78634511046.20.69309C0 Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) by imf04.hostedemail.com (Postfix) with ESMTP id A751B50000B3 for ; Mon, 27 Sep 2021 20:36:23 +0000 (UTC) Received: by mail-pj1-f54.google.com with SMTP id h12so2956082pjj.1 for ; Mon, 27 Sep 2021 13:36:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=KwntqUtVsNq0eUFSV1/o/nRAcymM++4zNUK+VLfzUDE=; b=qwIUO+3oC6laZ/gJKGvYxv3lflTfsHoCZozQwFOCCG93M44AOCtYwoSK4+BlxN6uMM xXIRst5Jp1b1D8GLGaK3cgg7QCm8wwMGodWCT3Yzt0Hb2ZWkJJT7jIWqZ/eBpR6P6oPs Ho3XAgMKKCBgJzgylh3jmiM5/KdLQdltQcC/ntQwQe8mPYrQ+iD9NWtQO94KwnTHmbcT 7ZMTHwRVTvo2Quxwo/TTRWC0MatJPUwxXLv4szstzuXPvM3ApWzeEiUHlgJXIR1tmX1u B/+dg7r7cJ44YMKuJ8Ct0BdcdzI1qAy/4DHMqaETzhldsUmSe91/m+Y+IbkStrwJZ2/z RHdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=KwntqUtVsNq0eUFSV1/o/nRAcymM++4zNUK+VLfzUDE=; b=X4qU6IcaVcOcLNFZI9ZtQ9KDy9Tqsmyu80DD/F66eWGa4VU5Est/+ChwkFjnbZenEc B+5Prbu2/44oilhBgm6xWuvkY3e3Bh2rubL62mOCjQWgbxjBif/9Jo+/mxQBKIyXfiZW Ss/vhWZYRnVjmjXTC2BbylJQTrInzIRD+2XJLnUoTg7P2I/7Y2eXFJR20Xf8b1SgqOFc Hsevi1ik4VPmJE7Qj1rA5vZl4dasfFmlLuHELJUc29cDqX3sYwWTwfxw1hqc4UVcVxnh eMS2SEpgsvunqE/HtbWyDX/suu5hu3BXW3i5AWsv20hNeUU4/6sIva37cmftRJ5cyd+h I31g== X-Gm-Message-State: AOAM530yNCD8Oj9VeRNkO9ehOSdXPlj0gXQl6JEv7Hyuxb49Y+v3InnF qQ08ptFxdK/uT9Uc94Pa1yw= X-Google-Smtp-Source: ABdhPJx6HFSHqBc+6nLSQK9verGhJtcB06qeQUgeN64cmC/mCUE1BD8FuJyvGrZIKjQ3gJHVjxsQ7Q== X-Received: by 2002:a17:90a:17e1:: with SMTP id q88mr1113946pja.99.1632774982476; Mon, 27 Sep 2021 13:36:22 -0700 (PDT) Received: from smtpclient.apple (c-24-6-216-183.hsd1.ca.comcast.net. [24.6.216.183]) by smtp.gmail.com with ESMTPSA id y24sm10396984pfo.69.2021.09.27.13.36.21 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Sep 2021 13:36:22 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: [RFC PATCH 4/8] mm/madvise: define madvise behavior in a struct From: Nadav Amit In-Reply-To: <20210927121449.kac5g25aejbwvylf@box> Date: Mon, 27 Sep 2021 13:36:20 -0700 Cc: Andrew Morton , Linux-MM , Linux Kernel Mailing List , Peter Xu , Andrea Arcangeli , Minchan Kim , Colin Cross , Suren Baghdasarya , Mike Rapoport Content-Transfer-Encoding: quoted-printable Message-Id: References: <20210926161259.238054-1-namit@vmware.com> <20210926161259.238054-5-namit@vmware.com> <20210927093103.g3cszw75gfctwtzk@box.shutemov.name> <48D4E700-0005-46D4-8EAA-B839D8449C66@gmail.com> <20210927121449.kac5g25aejbwvylf@box> To: "Kirill A. Shutemov" X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: A751B50000B3 X-Stat-Signature: bazd8ywbt9bx7t8r89mqa6ajt34httwo Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=qwIUO+3o; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf04.hostedemail.com: domain of nadav.amit@gmail.com designates 209.85.216.54 as permitted sender) smtp.mailfrom=nadav.amit@gmail.com X-HE-Tag: 1632774983-129432 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: > On Sep 27, 2021, at 5:14 AM, Kirill A. Shutemov = wrote: >=20 > On Mon, Sep 27, 2021 at 03:31:21AM -0700, Nadav Amit wrote: >>=20 >>=20 >>> On Sep 27, 2021, at 2:31 AM, Kirill A. Shutemov = wrote: >>>=20 >>> On Sun, Sep 26, 2021 at 09:12:55AM -0700, Nadav Amit wrote: >>>> From: Nadav Amit >>>>=20 >>>> The different behaviors of madvise are different in several ways, = which >>>> are distributed across several functions. Use the design pattern = from >>>> iouring in order to define the actions that are required for each >>>> behavior. >>>>=20 >>>> The next patches will get rid of old helper functions that are = modified >>>> in this patch and the redundant use of array_index_nospec(). The = next >>>> patches will add more actions for each leaf into the new struct. >>>=20 [ snip ] >>> MADV_SOFT_OFFLINE+1 smells bad. >>=20 >> I can set another constant instead and let the compiler shout if = anything >> outside the array is initialized. >=20 > I would rather introduce a function that would return struct = madvise_info > for a given behavior. The function would have a switch inside. The = default: > may have BUILD_BUG() or something. Sounds better than my solution. I will do so.=