From: Oren Laadan <orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
To: Dave Hansen <dave-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Subject: Re: [RFC v14-rc][PATCH 18/23] Prepare to support shared memory
Date: Thu, 26 Mar 2009 22:31:12 -0400 [thread overview]
Message-ID: <49CC3A70.8010403@cs.columbia.edu> (raw)
In-Reply-To: <1237584473.8286.307.camel@nimitz>
Dave Hansen wrote:
> On Fri, 2009-03-20 at 14:47 -0400, Oren Laadan wrote:
>> diff --git a/checkpoint/checkpoint_mem.h b/checkpoint/checkpoint_mem.h
>> index de1d4c8..3157dde 100644
>> --- a/checkpoint/checkpoint_mem.h
>> +++ b/checkpoint/checkpoint_mem.h
>> @@ -43,4 +43,22 @@ static inline int cr_pgarr_nr_free(struct cr_pgarr *pgarr)
>> return CR_PGARR_TOTAL - pgarr->nr_used;
>> }
>>
>> +/*
>> + * This probably belongs in include/linux/mm.h
>> + */
>> +
>> +/* Flag allocation requirements to shmem_getpage and shmem_swp_alloc */
>> +enum sgp_type {
>> + SGP_READ, /* don't exceed i_size, don't allocate page */
>> + SGP_CACHE, /* don't exceed i_size, may allocate page */
>> + SGP_DIRTY, /* like SGP_CACHE, but set new page dirty */
>> + SGP_WRITE, /* may exceed i_size, may allocate page */
>> +};
>> +
>> +int shmem_getpage(struct inode *inode, unsigned long idx,
>> + struct page **pagep, enum sgp_type sgp, int *type);
>> +
>> +extern struct vm_operations_struct shmem_vm_ops;
>> +extern struct vm_operations_struct shm_vm_ops;
> ...
>> --- a/mm/shmem.c
>> +++ b/mm/shmem.c
>> @@ -103,8 +103,8 @@ static unsigned long shmem_default_max_inodes(void)
>> }
>> #endif
>>
>> -static int shmem_getpage(struct inode *inode, unsigned long idx,
>> - struct page **pagep, enum sgp_type sgp, int *type);
>> +int shmem_getpage(struct inode *inode, unsigned long idx,
>> + struct page **pagep, enum sgp_type sgp, int *type);
>
> Personally, I think it is bad form to export someone else's function for
> them. Please move the current shmem.c function declaration to a header
> that can be included by both the c/r code and shmem.c
>
>> /* return the subtype of a shared vma segment */
>> static enum vm_type cr_shared_vma_type(struct vm_area_struct *vma, int new)
>> {
>> enum vm_type vma_type;
>>
>> if (vma->vm_ops == &shmem_vm_ops) /* /dev/zero or anonymous */
>> vma_type = CR_VMA_SHM_ANON;
>> else if (vma->vm_ops == &shm_vm_ops) /* IPC (unsupported yet) */
>> vma_type = -EINVAL;
>> else
>> vma_type = CR_VMA_SHM_FILE;
>>
>> if (!new && vma_type == CR_VMA_SHM_ANON)
>> vma_type = CR_VMA_SHM_ANON_SKIP;
>>
>> return vma_type;
>> }
>
> This just looks really fragile to me. The first thing that comes up in
> my cscope is bf5xx_pcm_mmap(). That is VM_SHARED, but is *certainly*
> not CR_VMA_SHM_FILE.
>
> Instead of *checking* vma->vm_ops, I believe the more correct solutions
> here is to add an new vm_op which can be asked for its CR_VMA_* type.
Yes, it will be cleaner. I'll give it a try.
Oren
next prev parent reply other threads:[~2009-03-27 2:31 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-20 18:47 [RFC v14-rc1][PATCH 00/23] Kernel based checkpoint/restart Oren Laadan
[not found] ` <1237574868-3371-1-git-send-email-orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-03-20 18:47 ` [RFC v14-rc][PATCH 01/23] Create syscalls: sys_checkpoint, sys_restart Oren Laadan
2009-03-20 18:47 ` [RFC v14-rc][PATCH 02/23] Checkpoint/restart: initial documentation Oren Laadan
2009-03-20 18:47 ` [RFC v14-rc][PATCH 03/23] Make file_pos_read/write() public Oren Laadan
2009-03-20 18:47 ` [RFC v14-rc][PATCH 04/23] General infrastructure for checkpoint restart Oren Laadan
[not found] ` <1237574868-3371-5-git-send-email-orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-03-20 21:24 ` Serge E. Hallyn
[not found] ` <20090320212400.GA15946-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-03-20 21:34 ` Oren Laadan
[not found] ` <49C40BDC.7050304-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-03-20 21:42 ` Serge E. Hallyn
2009-03-20 18:47 ` [RFC v14-rc][PATCH 05/23] x86 support for checkpoint/restart Oren Laadan
2009-03-20 18:47 ` [RFC v14-rc][PATCH 06/23] Dump memory address space Oren Laadan
2009-03-20 18:47 ` [RFC v14-rc][PATCH 07/23] Restore " Oren Laadan
[not found] ` <1237574868-3371-8-git-send-email-orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-03-20 23:54 ` Serge E. Hallyn
[not found] ` <20090320235433.GA19565-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-03-22 21:51 ` Oren Laadan
[not found] ` <49C6B2F6.6080304-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-03-23 15:01 ` Serge E. Hallyn
2009-03-20 18:47 ` [RFC v14-rc][PATCH 08/23] Infrastructure for shared objects Oren Laadan
2009-03-20 18:47 ` [RFC v14-rc][PATCH 09/23] Dump open file descriptors Oren Laadan
[not found] ` <1237574868-3371-10-git-send-email-orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-03-20 20:09 ` Dave Hansen
2009-03-20 20:55 ` Oren Laadan
[not found] ` <49C402BE.4010308-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-03-20 21:14 ` Dave Hansen
2009-03-24 15:24 ` Serge E. Hallyn
[not found] ` <20090324152442.GA18066-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-03-24 15:37 ` Oren Laadan
[not found] ` <49C8FE39.6040605-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-03-24 15:44 ` Serge E. Hallyn
2009-03-20 18:47 ` [RFC v14-rc][PATCH 10/23] Restore " Oren Laadan
2009-03-20 18:47 ` [RFC v14-rc][PATCH 11/23] External checkpoint of a task other than ourself Oren Laadan
2009-03-20 18:47 ` [RFC v14-rc][PATCH 12/23] Checkpoint multiple processes Oren Laadan
2009-03-20 18:47 ` [RFC v14-rc][PATCH 13/23] Restart " Oren Laadan
2009-03-20 18:47 ` [RFC v14-rc][PATCH 14/23] A new file type (CR_FD_OBJREF) for a file descriptor already setup Oren Laadan
[not found] ` <1237574868-3371-15-git-send-email-orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-03-20 20:11 ` Dave Hansen
2009-03-20 21:02 ` Oren Laadan
2009-03-20 20:14 ` Dave Hansen
2009-03-20 20:27 ` Dave Hansen
2009-03-20 21:01 ` Oren Laadan
[not found] ` <49C40447.3070604-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-03-20 21:14 ` Dave Hansen
2009-03-20 20:46 ` Dave Hansen
2009-03-20 18:47 ` [RFC v14-rc][PATCH 15/23] Checkpoint open pipes Oren Laadan
2009-03-20 18:47 ` [RFC v14-rc][PATCH 16/23] Restore " Oren Laadan
2009-03-20 18:47 ` [RFC v14-rc][PATCH 17/23] Record 'struct file' object instead of the file name for VMAs Oren Laadan
[not found] ` <1237574868-3371-18-git-send-email-orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-03-20 20:57 ` Dave Hansen
2009-03-20 21:20 ` Oren Laadan
[not found] ` <49C40893.1060602-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-03-20 21:30 ` Dave Hansen
2009-03-20 22:02 ` Oren Laadan
[not found] ` <49C41273.5000202-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-03-20 22:43 ` Dave Hansen
2009-03-20 18:47 ` [RFC v14-rc][PATCH 18/23] Prepare to support shared memory Oren Laadan
[not found] ` <1237574868-3371-19-git-send-email-orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-03-20 21:27 ` Dave Hansen
2009-03-27 2:31 ` Oren Laadan [this message]
2009-03-20 18:47 ` [RFC v14-rc][PATCH 19/23] Dump anonymous- and file-mapped- " Oren Laadan
2009-03-20 18:47 ` [RFC v14-rc][PATCH 20/23] Restore " Oren Laadan
[not found] ` <1237574868-3371-21-git-send-email-orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-03-20 21:42 ` Dave Hansen
2009-03-20 18:47 ` [RFC v14-rc][PATCH 21/23] s390: Expose a constant for the number of words representing the CRs Oren Laadan
2009-03-20 18:47 ` [RFC v14-rc][PATCH 22/23] c/r: Add CR_COPY() macro (v4) Oren Laadan
[not found] ` <1237574868-3371-23-git-send-email-orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-03-24 15:11 ` Serge E. Hallyn
[not found] ` <20090324151139.GA17589-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-03-27 2:19 ` Oren Laadan
2009-03-20 18:47 ` [RFC v14-rc][PATCH 23/23] s390: define s390-specific checkpoint-restart code (v7) Oren Laadan
2009-03-23 22:18 ` [RFC v14-rc1][PATCH 00/23] Kernel based checkpoint/restart Nathan Lynch
[not found] ` <20090323171818.4c238e9d-4v5LP+xe+1byhTdZtsIeww@public.gmane.org>
2009-03-23 23:35 ` Oren Laadan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49CC3A70.8010403@cs.columbia.edu \
--to=orenl-eqauephvms7envbuuze7ea@public.gmane.org \
--cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=dave-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox