From patchwork Tue Oct 13 01:34:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Safonov X-Patchwork-Id: 11834693 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0F1DF16BC for ; Tue, 13 Oct 2020 01:34:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BBE8B21741 for ; Tue, 13 Oct 2020 01:34:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=arista.com header.i=@arista.com header.b="YferU0tb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BBE8B21741 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=arista.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 935C894000D; Mon, 12 Oct 2020 21:34:27 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 8E85A94000B; Mon, 12 Oct 2020 21:34:27 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7142F94000D; Mon, 12 Oct 2020 21:34:27 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0214.hostedemail.com [216.40.44.214]) by kanga.kvack.org (Postfix) with ESMTP id 3D2F994000B for ; Mon, 12 Oct 2020 21:34:27 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id D4B7F8249980 for ; Tue, 13 Oct 2020 01:34:26 +0000 (UTC) X-FDA: 77365182132.07.tent41_34042f9271ff Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id B35C01803F9A8 for ; Tue, 13 Oct 2020 01:34:26 +0000 (UTC) X-Spam-Summary: 1,0,0,52c0f3200e0ff971,d41d8cd98f00b204,dima@arista.com,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1311:1314:1345:1359:1437:1515:1535:1543:1711:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3355:3865:3867:3871:3872:3874:4118:4321:4605:5007:6119:6261:6653:6742:6743:10004:11026:11473:11658:11914:12296:12297:12438:12517:12519:12555:12895:12986:13894:14096:14181:14394:14721:21080:21212:21444:21451:21627:21987:21990:30054:30070,0,RBL:209.85.221.66:@arista.com:.lbl8.mailshell.net-62.2.0.100 66.100.201.201;04ygm8xi3kqguxuigqskw4a34jmtzocjq6aakomcpkuzr4u9khagi4qqo4mjot3.a5eu3td5jud97zi9cj8b317xzmmgey9opmoidxhmwxjd7gakysqzjaqqx1yjptq.g-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: tent41_34042f9271ff X-Filterd-Recvd-Size: 7545 Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by imf44.hostedemail.com (Postfix) with ESMTP for ; Tue, 13 Oct 2020 01:34:26 +0000 (UTC) Received: by mail-wr1-f66.google.com with SMTP id n6so21536620wrm.13 for ; Mon, 12 Oct 2020 18:34:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arista.com; s=googlenew; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pPwHwZEP2PqHjnQGol/aPrlKhQ+v52jFp6WQVgPqijE=; b=YferU0tbNRf+gxmODbnA9Mqj4CpE0dtIAEistHAFS9i3faI1yKc65RMZjMueeuAd6K v90BcKD8EX8QrUHOBuc4RWU+YiTI127qs5q/pJVwzTOsSBeMcxB+oU2aVU55wR6pUlRv SK4XoL4NVCK1yi9eXXrxvr+Hj+52qancDHwYD07EaxXrNrtycjOMzvm0DxsjDe0Yr0Ym fy/5nhiDgsBYbPKPmos1hfATHBYfbuDpAX3q/tHFinsU09UpL8L6CMHFoHKZdGQST4Fx VqAQoWLpkvmc+4PZzRrMb/5p1F7aQWI0x1fji1HYeph0/+jjPTkmcPOZJhw2LejVQqoH 0K7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pPwHwZEP2PqHjnQGol/aPrlKhQ+v52jFp6WQVgPqijE=; b=OAxjRc95QuI3CUrvUJOj7rTUO3BpTKUN7nCgUtRM5YqtMsvC1nU+PTR135p+DfClUU yYxwwLSzNKHLWkS063XtFiYpdpbI939w/jNMKtUX2npipAm+OritQeTV+yKO9O2vGGkU VdslWSN2fEmncJqZKp7pN3Jr4Ct+INQCHsm1/fmFHnmuraOtvwWTFZkn9wKh+aT2hqaX kY8Hlx5ybIx4KKDjscjjXqCCqu9AYOsi8U2ZIKFGSNg7w6C2QCfVEfj/qOWl0W4gUPOm Gv1aVCF7Owcxq3jcj9gaoGJr7rkTq/QsnHsih1eqyvfaHkm/RTyXl19Tx5N6/V1DYUJv 5Wzg== X-Gm-Message-State: AOAM530qcen1r3AF12AtxhYB4J6SJxy3OUM0O//BrdyqlUf0qlAplehz 1aHADDTgPIE1vR6paRVzRvI0tA== X-Google-Smtp-Source: ABdhPJx2Iz5ia07SkXg8JuVb45XrLxBzUgObuPt4vpXjnHItp8RoscX39wxroX44gq9L0v4LP5bsSA== X-Received: by 2002:adf:fc8b:: with SMTP id g11mr480698wrr.300.1602552865214; Mon, 12 Oct 2020 18:34:25 -0700 (PDT) Received: from localhost.localdomain ([2a02:8084:e84:2480:228:f8ff:fe6f:83a8]) by smtp.gmail.com with ESMTPSA id d23sm24825325wmb.6.2020.10.12.18.34.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 18:34:24 -0700 (PDT) From: Dmitry Safonov To: linux-kernel@vger.kernel.org Cc: Dmitry Safonov <0x7f454c46@gmail.com>, Dmitry Safonov , Alexander Viro , Andrew Morton , Andy Lutomirski , Brian Geffon , Catalin Marinas , Dan Williams , Dave Jiang , Hugh Dickins , Ingo Molnar , "Kirill A. Shutemov" , Mike Kravetz , Minchan Kim , Russell King , Thomas Bogendoerfer , Thomas Gleixner , Vishal Verma , Vlastimil Babka , Will Deacon , linux-aio@kvack.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 4/6] vm_ops: Rename .split() callback to .may_split() Date: Tue, 13 Oct 2020 02:34:14 +0100 Message-Id: <20201013013416.390574-5-dima@arista.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201013013416.390574-1-dima@arista.com> References: <20201013013416.390574-1-dima@arista.com> MIME-Version: 1.0 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: Rename the callback to reflect that it's not called *on* or *after* split, but rather some time before the splitting to check if it's possible. Signed-off-by: Dmitry Safonov --- drivers/dax/device.c | 4 ++-- include/linux/mm.h | 3 ++- ipc/shm.c | 8 ++++---- mm/hugetlb.c | 2 +- mm/mmap.c | 4 ++-- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/dax/device.c b/drivers/dax/device.c index 1e89513f3c59..223dd1d13d5c 100644 --- a/drivers/dax/device.c +++ b/drivers/dax/device.c @@ -276,7 +276,7 @@ static vm_fault_t dev_dax_fault(struct vm_fault *vmf) return dev_dax_huge_fault(vmf, PE_SIZE_PTE); } -static int dev_dax_split(struct vm_area_struct *vma, unsigned long addr) +static int dev_dax_may_split(struct vm_area_struct *vma, unsigned long addr) { struct file *filp = vma->vm_file; struct dev_dax *dev_dax = filp->private_data; @@ -299,7 +299,7 @@ static unsigned long dev_dax_pagesize(struct vm_area_struct *vma) static const struct vm_operations_struct dax_vm_ops = { .fault = dev_dax_fault, .huge_fault = dev_dax_huge_fault, - .split = dev_dax_split, + .may_split = dev_dax_may_split, .pagesize = dev_dax_pagesize, }; diff --git a/include/linux/mm.h b/include/linux/mm.h index fd51a4a1f722..90887661ef44 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -549,7 +549,8 @@ enum page_entry_size { struct vm_operations_struct { void (*open)(struct vm_area_struct * area); void (*close)(struct vm_area_struct * area); - int (*split)(struct vm_area_struct * area, unsigned long addr); + /* Called any time before splitting to check if it's allowed */ + int (*may_split)(struct vm_area_struct *area, unsigned long addr); int (*mremap)(struct vm_area_struct *area, unsigned long flags); vm_fault_t (*fault)(struct vm_fault *vmf); vm_fault_t (*huge_fault)(struct vm_fault *vmf, diff --git a/ipc/shm.c b/ipc/shm.c index e25c7c6106bc..febd88daba8c 100644 --- a/ipc/shm.c +++ b/ipc/shm.c @@ -434,13 +434,13 @@ static vm_fault_t shm_fault(struct vm_fault *vmf) return sfd->vm_ops->fault(vmf); } -static int shm_split(struct vm_area_struct *vma, unsigned long addr) +static int shm_may_split(struct vm_area_struct *vma, unsigned long addr) { struct file *file = vma->vm_file; struct shm_file_data *sfd = shm_file_data(file); - if (sfd->vm_ops->split) - return sfd->vm_ops->split(vma, addr); + if (sfd->vm_ops->may_split) + return sfd->vm_ops->may_split(vma, addr); return 0; } @@ -582,7 +582,7 @@ static const struct vm_operations_struct shm_vm_ops = { .open = shm_open, /* callback for a new vm-area open */ .close = shm_close, /* callback for when the vm-area is released */ .fault = shm_fault, - .split = shm_split, + .may_split = shm_may_split, .pagesize = shm_pagesize, #if defined(CONFIG_NUMA) .set_policy = shm_set_policy, diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 67fc6383995b..c4dc0e453be1 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -3759,7 +3759,7 @@ const struct vm_operations_struct hugetlb_vm_ops = { .fault = hugetlb_vm_op_fault, .open = hugetlb_vm_op_open, .close = hugetlb_vm_op_close, - .split = hugetlb_vm_op_split, + .may_split = hugetlb_vm_op_split, .pagesize = hugetlb_vm_op_pagesize, }; diff --git a/mm/mmap.c b/mm/mmap.c index 50f853b0ec39..a62cb3ccafce 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2693,8 +2693,8 @@ int __split_vma(struct mm_struct *mm, struct vm_area_struct *vma, struct vm_area_struct *new; int err; - if (vma->vm_ops && vma->vm_ops->split) { - err = vma->vm_ops->split(vma, addr); + if (vma->vm_ops && vma->vm_ops->may_split) { + err = vma->vm_ops->may_split(vma, addr); if (err) return err; }