Re: [PATCH 1/2] BDI: Provide backing device capability information [try #3]
Andrew Morton <[EMAIL PROTECTED]> wrote: > > The attached patch replaces backing_dev_info::memory_backed with > > capabilitied bitmap. > > Looks sane to me, thanks. > > I hope you got all the conversions correct - breakage in the writeback > dirty accounting manifests in subtle ways. I'll double-check it. I think I got the logic as-was. This is quite easy to check just by looking at the patch. However, the as-was logic should possibly be changed to reflect the fact that the one control that there was has now been split into two. David - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] BDI: Provide backing device capability information [try #3]
Andrew Morton [EMAIL PROTECTED] wrote: The attached patch replaces backing_dev_info::memory_backed with capabilitied bitmap. Looks sane to me, thanks. I hope you got all the conversions correct - breakage in the writeback dirty accounting manifests in subtle ways. I'll double-check it. I think I got the logic as-was. This is quite easy to check just by looking at the patch. However, the as-was logic should possibly be changed to reflect the fact that the one control that there was has now been split into two. David - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] BDI: Provide backing device capability information [try #3]
David Howells <[EMAIL PROTECTED]> wrote: > > The attached patch replaces backing_dev_info::memory_backed with capabilitied > bitmap. Looks sane to me, thanks. I hope you got all the conversions correct - breakage in the writeback dirty accounting manifests in subtle ways. I'll double-check it. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] BDI: Provide backing device capability information [try #3]
The attached patch replaces backing_dev_info::memory_backed with capabilitied bitmap. The capabilities available include: (*) BDI_CAP_NO_ACCT_DIRTY Set if the pages associated with this backing device should not be tracked by the dirty page accounting. (*) BDI_CAP_NO_WRITEBACK Set if dirty pages associated with this backing device should not have writepage() or writepages() invoked upon them to clean them. (*) Capability markers that indicate what a backing device is capable of with regard to memory mapping facilities. These flags indicate whether a device can be mapped directly, whether it can be copied for a mapping, and whether direct mappings can be read, written and/or executed. This information is primarily aimed at improving no-MMU private mapping support. The patch also provides convenience functions for determining the dirty-page capabilities available on backing devices directly or on the backing devices associated with a mapping. These are provided to keep line length down when checking for the capabilities. Signed-Off-By: David Howells <[EMAIL PROTECTED]> --- diff -uNrp /warthog/kernels/linux-2.6.11-rc4/include/linux/backing-dev.h linux-2.6.11-rc4-memback/include/linux/backing-dev.h --- /warthog/kernels/linux-2.6.11-rc4/include/linux/backing-dev.h 2004-06-18 13:44:05.0 +0100 +++ linux-2.6.11-rc4-memback/include/linux/backing-dev.h2005-03-08 11:03:45.0 + @@ -25,13 +25,39 @@ typedef int (congested_fn)(void *, int); struct backing_dev_info { unsigned long ra_pages; /* max readahead in PAGE_CACHE_SIZE units */ unsigned long state;/* Always use atomic bitops on this */ - int memory_backed; /* Cannot clean pages with writepage */ + unsigned int capabilities; /* Device capabilities */ congested_fn *congested_fn; /* Function pointer if device is md/dm */ void *congested_data; /* Pointer to aux data for congested func */ void (*unplug_io_fn)(struct backing_dev_info *, struct page *); void *unplug_io_data; }; + +/* + * Flags in backing_dev_info::capability + * - The first two flags control whether dirty pages will contribute to the + * VM's accounting and whether writepages() should be called for dirty pages + * (something that would not, for example, be appropriate for ramfs) + * - These flags let !MMU mmap() govern direct device mapping vs immediate + * copying more easily for MAP_PRIVATE, especially for ROM filesystems + */ +#define BDI_CAP_NO_ACCT_DIRTY 0x0001 /* Dirty pages shouldn't contribute to accounting */ +#define BDI_CAP_NO_WRITEBACK 0x0002 /* Don't write pages back */ +#define BDI_CAP_MAP_COPY 0x0004 /* Copy can be mapped (MAP_PRIVATE) */ +#define BDI_CAP_MAP_DIRECT 0x0008 /* Can be mapped directly (MAP_SHARED) */ +#define BDI_CAP_READ_MAP 0x0010 /* Can be mapped for reading */ +#define BDI_CAP_WRITE_MAP 0x0020 /* Can be mapped for writing */ +#define BDI_CAP_EXEC_MAP 0x0040 /* Can be mapped for execution */ +#define BDI_CAP_VMFLAGS \ + (BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP) + +#if defined(VM_MAYREAD) && \ + (BDI_CAP_READ_MAP != VM_MAYREAD || \ +BDI_CAP_WRITE_MAP != VM_MAYWRITE || \ +BDI_CAP_EXEC_MAP != VM_MAYEXEC) +#error please change backing_dev_info::capabilities flags +#endif + extern struct backing_dev_info default_backing_dev_info; void default_unplug_io_fn(struct backing_dev_info *bdi, struct page *page); @@ -62,4 +88,17 @@ static inline int bdi_rw_congested(struc (1 << BDI_write_congested)); } +#define bdi_cap_writeback_dirty(bdi) \ + (!((bdi)->capabilities & BDI_CAP_NO_WRITEBACK)) + +#define bdi_cap_account_dirty(bdi) \ + (!((bdi)->capabilities & BDI_CAP_NO_ACCT_DIRTY)) + +#define mapping_cap_writeback_dirty(mapping) \ + bdi_cap_writeback_dirty((mapping)->backing_dev_info) + +#define mapping_cap_account_dirty(mapping) \ + bdi_cap_account_dirty((mapping)->backing_dev_info) + + #endif /* _LINUX_BACKING_DEV_H */ diff -uNrp /warthog/kernels/linux-2.6.11-rc4/drivers/block/ll_rw_blk.c linux-2.6.11-rc4-memback/drivers/block/ll_rw_blk.c --- /warthog/kernels/linux-2.6.11-rc4/drivers/block/ll_rw_blk.c 2005-02-14 12:18:23.0 + +++ linux-2.6.11-rc4-memback/drivers/block/ll_rw_blk.c 2005-03-08 11:09:54.0 + @@ -238,7 +238,7 @@ void blk_queue_make_request(request_queu q->make_request_fn = mfn; q->backing_dev_info.ra_pages = (VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE; q->backing_dev_info.state = 0; - q->backing_dev_info.memory_backed = 0; + q->backing_dev_info.capabilities = BDI_CAP_MAP_COPY; blk_queue_max_sectors(q, MAX_SECTORS); blk_queue_hardsect_size(q, 512); blk_queue_dma_alignment(q, 511); diff -uNrp
[PATCH 1/2] BDI: Provide backing device capability information [try #3]
The attached patch replaces backing_dev_info::memory_backed with capabilitied bitmap. The capabilities available include: (*) BDI_CAP_NO_ACCT_DIRTY Set if the pages associated with this backing device should not be tracked by the dirty page accounting. (*) BDI_CAP_NO_WRITEBACK Set if dirty pages associated with this backing device should not have writepage() or writepages() invoked upon them to clean them. (*) Capability markers that indicate what a backing device is capable of with regard to memory mapping facilities. These flags indicate whether a device can be mapped directly, whether it can be copied for a mapping, and whether direct mappings can be read, written and/or executed. This information is primarily aimed at improving no-MMU private mapping support. The patch also provides convenience functions for determining the dirty-page capabilities available on backing devices directly or on the backing devices associated with a mapping. These are provided to keep line length down when checking for the capabilities. Signed-Off-By: David Howells [EMAIL PROTECTED] --- diff -uNrp /warthog/kernels/linux-2.6.11-rc4/include/linux/backing-dev.h linux-2.6.11-rc4-memback/include/linux/backing-dev.h --- /warthog/kernels/linux-2.6.11-rc4/include/linux/backing-dev.h 2004-06-18 13:44:05.0 +0100 +++ linux-2.6.11-rc4-memback/include/linux/backing-dev.h2005-03-08 11:03:45.0 + @@ -25,13 +25,39 @@ typedef int (congested_fn)(void *, int); struct backing_dev_info { unsigned long ra_pages; /* max readahead in PAGE_CACHE_SIZE units */ unsigned long state;/* Always use atomic bitops on this */ - int memory_backed; /* Cannot clean pages with writepage */ + unsigned int capabilities; /* Device capabilities */ congested_fn *congested_fn; /* Function pointer if device is md/dm */ void *congested_data; /* Pointer to aux data for congested func */ void (*unplug_io_fn)(struct backing_dev_info *, struct page *); void *unplug_io_data; }; + +/* + * Flags in backing_dev_info::capability + * - The first two flags control whether dirty pages will contribute to the + * VM's accounting and whether writepages() should be called for dirty pages + * (something that would not, for example, be appropriate for ramfs) + * - These flags let !MMU mmap() govern direct device mapping vs immediate + * copying more easily for MAP_PRIVATE, especially for ROM filesystems + */ +#define BDI_CAP_NO_ACCT_DIRTY 0x0001 /* Dirty pages shouldn't contribute to accounting */ +#define BDI_CAP_NO_WRITEBACK 0x0002 /* Don't write pages back */ +#define BDI_CAP_MAP_COPY 0x0004 /* Copy can be mapped (MAP_PRIVATE) */ +#define BDI_CAP_MAP_DIRECT 0x0008 /* Can be mapped directly (MAP_SHARED) */ +#define BDI_CAP_READ_MAP 0x0010 /* Can be mapped for reading */ +#define BDI_CAP_WRITE_MAP 0x0020 /* Can be mapped for writing */ +#define BDI_CAP_EXEC_MAP 0x0040 /* Can be mapped for execution */ +#define BDI_CAP_VMFLAGS \ + (BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP) + +#if defined(VM_MAYREAD) \ + (BDI_CAP_READ_MAP != VM_MAYREAD || \ +BDI_CAP_WRITE_MAP != VM_MAYWRITE || \ +BDI_CAP_EXEC_MAP != VM_MAYEXEC) +#error please change backing_dev_info::capabilities flags +#endif + extern struct backing_dev_info default_backing_dev_info; void default_unplug_io_fn(struct backing_dev_info *bdi, struct page *page); @@ -62,4 +88,17 @@ static inline int bdi_rw_congested(struc (1 BDI_write_congested)); } +#define bdi_cap_writeback_dirty(bdi) \ + (!((bdi)-capabilities BDI_CAP_NO_WRITEBACK)) + +#define bdi_cap_account_dirty(bdi) \ + (!((bdi)-capabilities BDI_CAP_NO_ACCT_DIRTY)) + +#define mapping_cap_writeback_dirty(mapping) \ + bdi_cap_writeback_dirty((mapping)-backing_dev_info) + +#define mapping_cap_account_dirty(mapping) \ + bdi_cap_account_dirty((mapping)-backing_dev_info) + + #endif /* _LINUX_BACKING_DEV_H */ diff -uNrp /warthog/kernels/linux-2.6.11-rc4/drivers/block/ll_rw_blk.c linux-2.6.11-rc4-memback/drivers/block/ll_rw_blk.c --- /warthog/kernels/linux-2.6.11-rc4/drivers/block/ll_rw_blk.c 2005-02-14 12:18:23.0 + +++ linux-2.6.11-rc4-memback/drivers/block/ll_rw_blk.c 2005-03-08 11:09:54.0 + @@ -238,7 +238,7 @@ void blk_queue_make_request(request_queu q-make_request_fn = mfn; q-backing_dev_info.ra_pages = (VM_MAX_READAHEAD * 1024) / PAGE_CACHE_SIZE; q-backing_dev_info.state = 0; - q-backing_dev_info.memory_backed = 0; + q-backing_dev_info.capabilities = BDI_CAP_MAP_COPY; blk_queue_max_sectors(q, MAX_SECTORS); blk_queue_hardsect_size(q, 512); blk_queue_dma_alignment(q, 511); diff -uNrp
Re: [PATCH 1/2] BDI: Provide backing device capability information [try #3]
David Howells [EMAIL PROTECTED] wrote: The attached patch replaces backing_dev_info::memory_backed with capabilitied bitmap. Looks sane to me, thanks. I hope you got all the conversions correct - breakage in the writeback dirty accounting manifests in subtle ways. I'll double-check it. - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/